5

I'm using MSTest with Visual Studio 2012, is it possible to see which test runs first, second third and so forth?

I prefer the tests to run in random orders but I just want to know when tests fail, I like to know the sequence they ran and helps me to figure out why they fail easier.

Ray Cheng
  • 12,230
  • 14
  • 74
  • 137
  • Please check the [link](http://stackoverflow.com/questions/288805/how-does-mstest-visual-studio-2008-team-test-decide-test-method-execution-order), which may be helpful to you – Imran Aug 23 '13 at 09:01
  • 1
    @Imran, thanks for the link. It just said the order is not always the same but still I don't have a way to see which executed first, second, third and forth etc. – Ray Cheng Aug 23 '13 at 14:25
  • You can [create ordered list](http://msdn.microsoft.com/en-us/library/ms182631.aspx) – Imran Aug 24 '13 at 07:25

2 Answers2

2

If you want to know the sequence in which your test ran you can do the following:

A bit of work to do:

  1. Add a breakpoint at the start of your method decorated with attribute 'TestMethod'.
  2. Right click your breakpoint and select 'When Hit...'.
  3. Make sure the checkbox next to 'Print a message' is ticked.

    Do this for all your test methods.

Let Visual Studio do the rest:

  • Debug all your tests by pressing ALT + S, D, A.

Wow! It worked:

  • Find the sequence in your debug output window (ALT + V, O).
mathijsuitmegen
  • 2,270
  • 1
  • 34
  • 36
0

There are two different concepts Coded UI Test - Mostly automation will be in done in these test MS Test - Mostly unit tests will be written here

Its not possible to run MSTest in order even if you define .playlist file these will never run in sequence.

However in CodedUI case you will use and create Ordred list.

So the answer is NO. The reasoning behind that is - these are unit test case and all the unit test cases are meant to be executed independently.

TARJU
  • 1,785
  • 1
  • 14
  • 16