Does Microsoft.Silverlight.Testing have an execution order?

I am trying to follow two methods, marked [TestMethod]

in order

First: Login
Second: GetUser

But MsTest picks Second

first.

Is there a way to set the order of execution of the labeled methods [TestMethod]

?

+2


source to share


1 answer


Ordering your tests is like bad design. Most unit testing units will not allow you to order your tests for this very reason. It looks like you should organize your tests like this:

Test 1: check that the user can log in.

Test 2: Fake logged in user, make sure GetUser returns this fake user.



You must ensure that your system is designed to provide such testing (tampering / mocking parts for tests). Otherwise, you end up with immeasurable tests that all break when something happens.

Think of it this way: in the second test, you are not testing the login process, so why should the test break if the login is broken? It shouldn't, so you need to make sure that you can remove the dependency on the actual login process and instead use some method of configuring the user that has been registered that cannot fail.

+4


source







All Articles