How to define dependency between tests in MStest How to define dependency between tests in MStest selenium selenium

How to define dependency between tests in MStest


Unit Tests should always be isolated and completly non dependent on and thing else to run, not make non-fragile.

You could setup catagories with MSTest to seperate them into deferent logical structures.

A great book to find more details is this http://artofunittesting.com

Roy has also does alot of public speaking which is recorded online

Cheers


Tests shouldn't have dependencies between them.

If you have dependencies, then running them in a different order, or in isolation will cause them to fail sporadically - this can be very confusing for anyone else that is running the tests.

It's much better to define tests that setup their own data and assert something specific. You can use a mocking framework like Rhino Mocks to reduce the dependencies between modules of code by faking (mocking) areas that aren't relevant to your test. This is made much easier if you also use a dependency injection framework like Microsoft Unity as your code will have many more seams where mocking can be applied.