Aug 16, 2009

Ordering unit tests in Visual Studio

Unit testing framework in Visual Studio is very handy and encourages test-driven development.

The most important thing about tests is the ordering and that's why a separate kind of test called "Ordered tests" are available in Visual Studio.

Steps:
1) Create your unit tests
2) Create an ordered test and select the unit tests to be executed and the order of execution

Advantages:
1) You can add the unit tests multiple times, which helps in let's say you want to add data, delete data and delete data again. The first delete is positive testing and second delete being negative testing.
2) You can decide whether to continue on failure of any of the tests, that way you don't have to execute tests unnecessarily if a dependent test has failed.

Refer to this MSDN link for steps to create ordered tests.
http://msdn.microsoft.com/en-us/library/ms182631.aspx

To learn more on Test Driven Development(TDD)
http://en.wikipedia.org/wiki/Test-driven_development
Reblog this post [with Zemanta]

No comments:

Post a Comment