Overview
End of NUnitAsp Development
31 January 2008
Hi all,
I'm making it official: I am no longer maintaining or supporting NUnitAsp.
I've been neglecting NUnitAsp for several years, so I doubt this is a surprise. I originally wrote NUnitAsp in 2002 (starting with a seed provided by Brian Knowles), before .NET was even out of beta, to solve the problem of unit testing ASP.NET code for a portal application. As the portal grew more complex, so did NUnitAsp. But this approach always led to holes in NUnitAsp--the features of ASP.NET I didn't use didn't get any love. One big example: I always worked strictly in the ASP.NET component model, so my pages never had more than one form and I didn't use HTML or Javascript directly.
That project ended years ago, but I kept NUnitAsp alive, even though I haven't written any ASP.NET code for a long time. The NUnitAsp v2.0 release last year was my last attempt to fill in the big holes. Now it supports multiple forms, has a simpler syntax, and it tests HTML as well as ASP.NET server-side components.
NUnitAsp still has some dramatic flaws: no support for Javascript, tests running in a different process than ASP.NET, difficulty setting up sessions. Most people ended up using it for acceptance testing, rather than unit testing, and Selenium, Watir, and the like are better for that. Most folks "in the know" are using presentation layers to make ASP.NET so thin that a tool like NUnitAsp isn't helpful.
Despite these flaws, I think NUnitAsp is an interesting tool. I'm proud of the code and the API. If nothing else, it's a good example of what a dedicated agilist will do when faced with a brand-new platform: he finds a way to unit test it.
If you would like to take over development of NUnitAsp, and you have name recognition in the community, I will be happy to hand it over to you. If I don't recognize you, feel free to fork the code. When your fork is successful, let me know, and I will give you the keys to the "official" project. NUnitAsp still gets between one and two thousand downloads per month, so it's not quite dead yet.
Thanks for your interest in NUnitAsp and in sticking with me over the years. I'm not going away, of course--I just have other projects that are occupying my time. I write about them at jamesshore.com.
Best wishes,
Jim
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.
Once you have an automated suite of tests, you'll never go back. It gives you incredible confidence in your code. That confidence allows you to code much faster, because you can make risky changes secure in the knowledge that your tests will catch any mistakes.
NUnitAsp is for unit testing ASP.NET code-behind only. It's meant for programmers, not QA teams, and it's not very good for QA-style acceptance tests. It only tests server-side logic. JavaScript and other client-side code is ignored. But if you're using ASP.NET, it's an essential part of your programmers' toolset.
NUnitAsp is freely available under the MIT license.
How It Works
NUnitAsp is a class library for use within your NUnit tests. It provides NUnit with the ability to download, parse, and manipulate ASP.NET web pages.
With NUnitAsp, your tests don't need to know how ASP.NET renders controls into HTML. Instead, you can rely on the NUnitASP library to do this for you, keeping your test code simple and clean. For example, your tests don'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 the freedom to focus on functionality questions, like whether the DataGrid holds the expected values.
Simply speaking, NUnitAsp makes it very easy to unit test ASP.NET web pages.
[Test]
public void TestExample()
{
// First, instantiate "Tester" objects:
LabelTester label = new LabelTester("textLabel");
LinkButtonTester link = new LinkButtonTester("linkButton");
// Second, visit the page being tested:
Browser.GetPage("http://localhost/example/example.aspx");
// Third, use tester objects to test the page:
Assert.AreEqual("Not clicked.", label.Text);
link.Click();
Assert.AreEqual("Clicked once.", label.Text);
link.Click();
Assert.AreEqual("Clicked twice.", label.Text);
}
NUnitAsp can test complex web sites involving multiple pages and nested controls. The common ASP.NET controls are supported (see complete list below), and support for additional controls is easy to add.
Latest Release: Version 2.0
Version 2.0 is a major update. Most significant changes:
- Tests ASP.NET 2.0 pages.
- Works with any version of any testing framework.
- Supports multiple forms.
- Tests can directly modify form variables, submit forms, and post-back forms.
- Added a boatload of new testers, including a generic tester for any HTML tag.
- Supports using XPath to find HTML tags.
- Removed need to use CurrentWebForm parameter.
- Added Advanced NUnitAsp video.
See the change log for a complete list of changes. If you're upgrading from a previous version of NUnitAsp, be sure to read the migration guide.
Controls supported in this release:
System.Web.UI.WebControls | System.Web.UI.HtmlControls |
---|---|
Button
CheckBox CompareValidator (new!) CustomValidator (new!) DataGrid DropDownList ImageButton Label LinkButton ListBox Panel RadioButton RangeValidator (new!) RegularExpressionValidator (new!) Repeater (new!) RequiredFieldValidator (new!) TextBox UserControl ValidationSummary |
generic HTML tag tester(new!)
HtmlAnchor HtmlButton (new!) HtmlInputButton (new!) HtmlInputCheckBox (new!) HtmlInputHidden (new!) HtmlInputImage (new!) HtmlInputRadioButton (new!) HtmlInputText (new!) HtmlSelect (new!) HtmlSpan (new!) HtmlTable (new!) HtmlTextArea (new!) HtmlInputCheckBox |
Credits and History
James Shore created today's NUnitAsp while leading a team creating a commercial web application in the beta days of ASP.NET. Unwilling to develop without the safety net of test-driven development, he took over Brian Knowles' open-source application for testing ASP.NET and updated it to support full TDD of ASP.NET code-behind. Since releasing the first version of NUnitAsp on SourceForge in 2002, he's seen it grow into an application that's downloaded thousands of times every month.
Since the original release, dozens of people have contributed time and effort to NUnitAsp. Of particular note is Levi Khatskevitch, who joined the team in November 2003 and coordinated the integration of patches and contributed many new features and improvements to version 1.4 and 1.5. For a complete list of contributors, see our change log.
In 2006 and 2007, NUnitAsp languished as James turned his attention to other projects. The v2.0 release, published in June 2007, will be the last release James produces. He is looking for someone else to take over; if you would like to do so, please post to the nunitasp-devl mailing list.
Last updated for v2.0.