Can you specify the order of test execution in VS 2005 test box?

I'm using the provided Unit Test Engine in Visual Studio 2005 and wondering if there is a way to specify the order of the tests. I have numerous test classes and numerous test methods inside each. I would like to control the order in which the test classes are executed and the order of the test methods in each.

+1


a source to share


2 answers


you can use Ordered Tests



http://msdn.microsoft.com/en-us/library/ms182629(VS.80).aspx

+2


a source


Why? In fact, tests are supposed to work alone. If you need to execute any specific code before running your test, you should have this in your test class:

//Use TestInitialize to run code before running each test
[TestInitialize()]
public void MyTestInitialize()
{
}

//Use TestCleanup to run code after each test has run
[TestCleanup()]
public void MyTestCleanup()
{
}

      



I don't think the order in which your test is executed should matter. But if you really need to order a link from Matthew White's side.

+3


a source







All Articles