Jusqu'à présent je connaissait NUnit, mais j'ignorais totalement l'existance de NUnitAsp. On peu deviner que c'est un outil de test unitaire pour page ASP.Net.
Pour ne pas l'avoir encore utilisé, mais simplement lu la page qui ce trouve
ici.
Voici le texte:NUnitAsp is a tool for automatically testing ASP.NET web pages. It's an extension to NUnit, a tool for test-driven development in .NET.
Onceyou have an automated suite of tests, you'll never go back. It givesyou incredible confidence in your code. That confidence allows you tocode much faster, because you can make risky changes secure in theknowledge that your tests will catch any mistakes.
NUnitAspis for unit testing ASP.NET code-behind only. It's meant forprogrammers, not QA teams, and it's not very good for QA-styleacceptance tests. It only tests server-side logic. JavaScript and otherclient-side code is ignored. But if you're using ASP.NET, it's anessential part of your programmers' toolset.
NUnitAsp is freely available under the MIT license.
How It Works
NUnitAspis a class library for use within your NUnit tests. It provides NUnitwith the ability to download, parse, and manipulate ASP.NET web pages.
WithNUnitASP, your tests don't need to know how ASP.NET renders controlsinto HTML. Instead, you can rely on the NUnitASP library to do this foryou, keeping your test code simple and clean. For example, your testsdon't need to know that a DataGrid control renders as an HTML table.You can rely on NUnitASP to handle the details. This gives you thefreedom to focus on functionality questions, like whether the DataGridholds the expected values.
Simply speaking, NUnitAsp makes it very easy to unit test ASP.NET web pages.
[Test]
public void TestExample()
{
LabelTester label = new LabelTester("textLabel", CurrentWebForm);
LinkButtonTester link = new LinkButtonTester("linkButton", CurrentWebForm);
Browser.GetPage("http://localhost/example/example.aspx");
AssertEquals("Not clicked.", label.Text);
link.Click();
AssertEquals("Clicked once.", label.Text);
link.Click();
AssertEquals("Clicked twice.", label.Text);
}
NUnitAsp can test complex web sites involving multiple pages and nestedcontrols. The common ASP.NET controls are supported (see complete listbelow), and support for additional controls is easy to add.
Latest Release: Version 1.5.1
Version1.5 includes a modest collection of improvements over version 1.4. Themost important new feature is improved custom tester support. We'veexposed a number of methods needed for writing custom testers and we'vecreated a new HtmlTag class that's easy to use and understand. Even ifyou aren't writing custom testers, you'll appreciate 1.5's improvederror reporting and API documentation. Particularly handy is the newability to report server-side ASP.NET exceptions directly within testfailure messages.
Version 1.5.1 is nearly identical to version 1.5. It requires NUnit 2.2 rather than NUnit 2.1. Download version 1.5.1 here, or take a look at the change log.
Controls supported in this release:
| System.Web.UI.WebControls | System.Web.UI.HtmlControls |
Button CheckBox DataGrid DropDownList ImageButton Label LinkButton ListBox Panel RadioButton TextBox UserControl ValidationSummary | HtmlAnchor HtmlInputCheckBox |
Credits and History
NUnitAspwas created by Brian Knowles as a simple way to read and manipulate webdocuments with NUnit. Jim Shore (known at the time as "Jim Little")took over the project shortly afterwards and refactored it to theTester-based approach used for the first release. Since then, more thana dozen people have contributed to the product. In November 2003, LeviKhatskevitch joined the team as "patch king" and brought new energy tothe project, leading to the long-anticipated release of version 1.4.
NUnitAspis downloaded hundreds of time every month and is mentioned on websites around the world. It needs your support to continue to grow andimprove! If there's a tester or other feature you can contribute, codeit up and send it to us. For more information, see the Contributions page.