views:

45

answers:

1

In my test list, my ordered test appears and runs, but each individual test that composes the ordered list is run a second time outside the list if I run all the tests.

What is the point of the ordered list if it's going to run them nondeterministically as well? Am I missing something?

+1  A: 

For unit testing, ordered tests is exactly what you DON'T want.

However, for some cases of integration testing and regression acceptance testing where you do automated end-to-end tests of a system you might want it. For instance, application test data often is expensive to prepare and you might decide that some limited side effects between tests are ok, but should be keept at least consistent between test runs.

Mahol25
Your first statement is sort of what I was thinking.However, in an automated build environment where unit test passage is critical for a successful build, I would imagine these sorts of tests have no place.
BC
Yea. Proper unit tests have to be fast and test a small piece of production code in isolation. Fast because your CI build must be fast, even with several thousand tests. Your unit tests should depend on very little = low coupling/fan-out. When production code changes then few tests are impacted. They also have to be independent, so that they don't add maintenence weight as the system evolves = test atomicity (=> agility). Best way to achieve atomicity is for each test method itself to setup everything it depends on, which requires a high level of decoupling and well designed types.
Mahol25