I have been caught out in the past with running multiple unit tests in that the order in which the tests run may not be in the order in which they are declared in the test class, and may in fact be in order of test method name. e.g. if I have
[Test]
public void PreviousTest()
{
}
[Test]
public void LaterTest()
{
}
Then LaterTest
gets run first as its name appears before PreviousTest
when ordered alphabetically.
This won’t matter if all of your tests are entirely independent, but if they are modifying shared resources then you may get unusual behaviour if you were expecting that LaterTest
‘s changes wouldn’t have any effect on PreviousTest
due to it being declared second.