Creating Ordered Tests

Visual Studio enables you to group unit tests together, set their sequence of execution, and treat the results as if a single test was run. This can be useful if you need to write unit tests that are dependent on one another. For example, you might insert a record in one test and rely on that record being there in a later test. Of course, this goes against a good practice for unit testing; each test should be able to execute independently. Thankfully, you can create an ordered test that groups the individual unit tests into a new, self-contained test.

You add an ordered test to your test project by right-clicking the project and selecting Add, Ordered Test. You can also select the Ordered Test template from the Add New ...

Get Microsoft® Visual Studio® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.