Andrew Skiba 05468b1253 NunitWeb test suite - create separate versions of Web.config for mono and for .Net há 19 anos atrás
..
Resources 05468b1253 NunitWeb test suite - create separate versions of Web.config for mono and for .Net há 19 anos atrás
BaseControl.cs 737ae5d65e Ability to run tests on real web server; documentation corrections. há 19 anos atrás
BaseControlCollection.cs 737ae5d65e Ability to run tests on real web server; documentation corrections. há 19 anos atrás
BaseInvoker.cs 737ae5d65e Ability to run tests on real web server; documentation corrections. há 19 anos atrás
BaseRequest.cs 737ae5d65e Ability to run tests on real web server; documentation corrections. há 19 anos atrás
BaseWorkerRequest.cs 992b155ab8 replace <seealso> tags to <see> to work around NDoc bug. há 19 anos atrás
FAQ 101d846c4c add TODO and FAQ há 19 anos atrás
FakeMembershipProvider.cs 4abc469313 * fixed DateTime.FromBinary to DateTime.Now há 19 anos atrás
FormRequest.cs b6297d9e6b Add new test for System.Web.System.Web.UI.WebControls.CrossPagePostingTest.cs; há 19 anos atrás
HandlerInvoker.cs 992b155ab8 replace <seealso> tags to <see> to work around NDoc bug. há 19 anos atrás
IForeignData.cs 3b0ec97744 Inline documentation is complete. This commit includes also some minor interface changes. há 19 anos atrás
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 há 19 anos atrás
MyHost.cs 3ccd99c67a SendHeaders stub method há 19 anos atrás
MyHost.jvm.cs bc6d946073 output WebException response stream há 19 anos atrás
NunitWeb-default.csproj a861f3b841 Add projects for generating the documentation with NDoc há 19 anos atrás
NunitWeb-default.sln a861f3b841 Add projects for generating the documentation with NDoc há 19 anos atrás
NunitWeb.csproj e6d798c7f9 add ref to Soap formatter há 19 anos atrás
NunitWeb.vmwcsproj ebd68f4948 run NunitWeb on GH 2.0 há 19 anos atrás
NunitWeb20.vmwcsproj 485289b578 add projects and batch files for GH 2.0 tests há 19 anos atrás
PageDelegates.cs 992b155ab8 replace <seealso> tags to <see> to work around NDoc bug. há 19 anos atrás
PageInvoker.cs 992b155ab8 replace <seealso> tags to <see> to work around NDoc bug. há 19 anos atrás
PostableRequest.cs 737ae5d65e Ability to run tests on real web server; documentation corrections. há 19 anos atrás
PostableWorkerRequest.cs 3b0ec97744 Inline documentation is complete. This commit includes also some minor interface changes. há 19 anos atrás
README 5ef0eab7f7 readme update há 19 anos atrás
Response.cs 992b155ab8 replace <seealso> tags to <see> to work around NDoc bug. há 19 anos atrás
StandardUrl.cs 2d4d7b56a5 2006-09-21 Gonzalo Paniagua Javier <[email protected]> há 19 anos atrás
TODO e9ee3eda80 há 19 anos atrás
WebTest.cs 05468b1253 NunitWeb test suite - create separate versions of Web.config for mono and for .Net há 19 anos atrás
nunitweb.ndoc 737ae5d65e Ability to run tests on real web server; documentation corrections. há 19 anos atrás

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);
}