Konstantin Triger 02e6900f88 workaround TARGET_JVM platform issues 19 vuotta sitten
..
Resources 02e6900f88 workaround TARGET_JVM platform issues 19 vuotta sitten
BaseControl.cs 737ae5d65e Ability to run tests on real web server; documentation corrections. 19 vuotta sitten
BaseControlCollection.cs 737ae5d65e Ability to run tests on real web server; documentation corrections. 19 vuotta sitten
BaseInvoker.cs 737ae5d65e Ability to run tests on real web server; documentation corrections. 19 vuotta sitten
BaseRequest.cs ba92e7ea1d store HttpStatusCode in WebTest.Response 19 vuotta sitten
BaseWorkerRequest.cs ba92e7ea1d store HttpStatusCode in WebTest.Response 19 vuotta sitten
FAQ 101d846c4c add TODO and FAQ 19 vuotta sitten
FakeMembershipProvider.cs 8ce11f4c1c * System.Web_test.dll.sources: added PasswordRecoveryTest.cs, PasswordRecoveryTest.cs 19 vuotta sitten
FormRequest.cs b6297d9e6b Add new test for System.Web.System.Web.UI.WebControls.CrossPagePostingTest.cs; 19 vuotta sitten
HandlerInvoker.cs 992b155ab8 replace <seealso> tags to <see> to work around NDoc bug. 19 vuotta sitten
IForeignData.cs 82f18eb92e XML document additions 19 vuotta sitten
MyHandler.cs ccb0c91e4f copy resources before creating domain so web.config is seen by the runtime; serialize WebTest between domains instead of copying field in MyData; add UserData property for custom data transfer in tests 19 vuotta sitten
MyHost.cs ed11296c51 Run all the WebTests in one and only one TreadPool thread 19 vuotta sitten
MyHost.jvm.cs 02e6900f88 workaround TARGET_JVM platform issues 19 vuotta sitten
MyPageHandlerFactory.cs 1be80554e7 fix the merge error 19 vuotta sitten
NunitWeb-default.csproj a861f3b841 Add projects for generating the documentation with NDoc 19 vuotta sitten
NunitWeb-default.sln a861f3b841 Add projects for generating the documentation with NDoc 19 vuotta sitten
NunitWeb.csproj 053e1e5ba0 Use standard .ashx for handler instead of "page.fake"; handle Application_Error in Global.asax 19 vuotta sitten
NunitWeb.vmwcsproj ebd68f4948 run NunitWeb on GH 2.0 19 vuotta sitten
NunitWeb20.vmwcsproj d74cc26289 19 vuotta sitten
PageDelegates.cs 992b155ab8 replace <seealso> tags to <see> to work around NDoc bug. 19 vuotta sitten
PageInvoker.cs 992b155ab8 replace <seealso> tags to <see> to work around NDoc bug. 19 vuotta sitten
PostableRequest.cs 82f18eb92e XML document additions 19 vuotta sitten
PostableWorkerRequest.cs 3b0ec97744 Inline documentation is complete. This commit includes also some minor interface changes. 19 vuotta sitten
README 5ef0eab7f7 readme update 19 vuotta sitten
Response.cs ba92e7ea1d store HttpStatusCode in WebTest.Response 19 vuotta sitten
StandardUrl.cs 053e1e5ba0 Use standard .ashx for handler instead of "page.fake"; handle Application_Error in Global.asax 19 vuotta sitten
TODO e9ee3eda80 19 vuotta sitten
WebTest.cs 5585185d36 avoid using multiple appdomains in NunitWeb; have only the default and target AppDomains 19 vuotta sitten
nunitweb.ndoc 737ae5d65e Ability to run tests on real web server; documentation corrections. 19 vuotta sitten

README

The idea of the framework is as the following. A web application root is created
in a temp directory. All currently referenced and loaded assemblies are copied
to the /bin folder. Starting from this point, HttpRuntime.ProcessRequest() is
able to process any requests, compiling aspx, themes, master pages, etc. if
necessary.

Few words about the API.

WebTest is the central class of the framework. It's instances are typically
created in Nunit testcases. WebTest instances carry the information from the
testcase appdomain into the web application appdomain, and back. The most
important properties of WebTest are Request and Invoker. The request carries all
the information, necessary to create an HttpWorkerRequest in the web appdomain.
The invoker carries all the callbacks which have to be invoked to perform the
tests in the web appdomain. Here is an example of using the WebTest, Request,
and Invoker.

[Test]
public void TestCase1 ()
{
WebTest t = new WebTest ();
t.Invoker = PageInvoker.CreateOnLoad (TestCase1OnLoad));
t.Request.Url = "MyPage.aspx";
string htmlRes = t.Run();
//HtmlDiff on htmlRes ...
}

static public void TestCase1OnLoad (Page p) //invoked in the web appdomain
{
Assert.AreEqual ("White", p.StyleSheetTheme);
}

There is a support for postback. The flow goes like this: you make a first
request like:

WebTest t = new WebTest ("SomePage.aspx");
t.Run ();

Then you use the response to create a FormRequest:

FormRequest f = new FormRequest (t.Response);

This will parse the response, and use action URL, GET/POST method and all
hidden fields (VIEWSTATE, etc.) You might add more query parameters, like

f.Controls.Add (new BaseControl ("button1", ""));
f.Controls.Add (new BaseControl ("textbox1", "some text");

and run the second request:

t.Request = f;
t.Run ();

It can be useful to install some callbacks for the second request, before
calling to t.Run(), like the following:

t.Invoker = PageInvoker.CreateOnLoad (MyDelegate);

the delegate for the above test might look like:

t.Invoker = PageInvoker.CreateOnLoad (MyDelegate);

static public void MyDelegate (Page p)
{
Assert.IsTrue (p.IsPostBack);
Assert.AreEqual ("some text", ((TextControl)p.FindControl ("textbox1")).Text);
}