BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News NUnit 2.5 had been Released

NUnit 2.5 had been Released

Leia em Português

This item in japanese

Bookmarks

Although only a small version number change (from 2.4.8), NUnit 2.5 represents a large amount of new functionality and has been nearly a year in the making. Charlie Poole, consultant and developer of NUnit, has written a top ten feature list:

Reason 1: Data-Driven Tests Test methods may have arguments and the data for them may be supplied in a number of ways: inline, from a separate method or class or randomly. This feature gives you a succinct way to express a set of examples to be used in running individual test cases.

Reason 2: Theories Traditional, example-based, testing allows you to select one or more sets of values to use in testing such a program. A Theory, on the other hand, allows you to express the generalization itself, writing a test that will pass for whatever values are passed to it, provided they meet the stated constraints.

Reason 3: Inline Expected Exception Tests With the introduction of the Assert.Throws assertion method and the even more powerful constraint expressions Throws.Exception, Throws.InstanceOf and Throws.TypeOf, exception testing logic can now be moved right into the test along with any other necessary assertions.

Reason 4: Generic Support and Reason 5: Lambda Support

Reason 6: Out-of-Process Execution and Runtime Selection NUnit 2.5 extends the AppDomain isolation approach to running tests under one or more separate processes. Aside from the isolation it provides, this allows running the tests under a different version of the .NET runtime from the one NUnit is currently using.

Reason 8: Source Code Display The new stack trace display in the Errors and Failures tab of the Gui is able to display the source code at the location where a problem occured, provided the source is available and the program was compiled with debug information. Currently, syntax coloring for C# is provided.

The release notes go on to provide more detail and describe other features.

Simone Busoli, says that the new constraints model is alot more expressiveness. In addition he likes the new assertions and modifiers to customize those assertions. In particular he notes that: “having modifiers accept inline methods is great for the million times when you have to compare two objects for in/equality and you want to override the concept of equality those objects have in your domain.”

Olof Bjarnason finds the new Timeout Attribute to be valuable when developing loops. In the past when mistakes were made and an infinite loop was written you had to kill the NUnit process. Now the timeout will just break out of the test.

In addition Jamie Cansdale has released a new version of TestDriven .NET, a tool that allows developers to run their NUnit (and other frameworks) Tests inside Visual Studio.

Charlie promised that in the future there will be a return to smaller more frequent releases. The NUnit 3.0 Roadmap(pdf) promises support for a great variety of test runners (including Web runner which will execute tests on a web server). The test engine layer will add support for distribution and running tests in parallel; random ordering of tests and Transactional test behavior.

Other .NET Unit Test tools include: MBunit, CSUnit, xUnit.Net, NBehave and Gallio - an open, extensible, and neutral test runner designed to support all .NET test tools.

Rate this Article

Adoption
Style

BT