Ordered testing with XUnit, NUnit and MSTest part 1: The setup
In the previous post we have compared three testing frameworks: MSTest, NUnit, and XUnit. In this series, we are going to implement ordered tests in these frameworks. The code for this post can be found on GitHub.
This post is part of a series of posts on ordered testing:
- Ordered testing with XUnit, NUnit and MSTest part 1: The setup
- Ordered testing with XUnit, NUnit and MSTest part 2: MSTest
- Ordered testing with XUnit, NUnit and MSTest part 3: NUnit
- Ordered testing with XUnit, NUnit and MSTest part 4: XUnit
- Ordered testing with XUnit, NUnit and MSTest part 5: NUnit implementation revised
- Ordered testing with XUnit, NUnit and MSTest part 6: NUnit implementation revised part 2
Why ordered testing?
Ordered testing is often useful when writing integration tests. Often an integration test consists of multiple steps which you want to be able to test as seperate units. Splitting an long integration test into different tests improves maintainability. This is especially useful for tests which use web automation frameworks like Selenium. If you look at the past sentences, you’Il notice we actually want to express dependencies between tests: One test may not run without the other.
Our set-up
We are going to define three test classes which must be executed in order:
- PreIntegrationTest
- IntegrationTest
- PostIntegrationTest
Within each test class we have tests which are also dependend on order. In IntegrationTest
we define a fictional integration test: CRUD of an entity.
Our goal
We want to order our tests based on their dependencies. Tests may be dependend on a other, so the dependency must be executed first.
In the next post, we will implement ordered testing using MSTest.
What are your thoughts?