4

I have a number of classes which contain unit tests for example

 Test class 1(){
   test method 1
   test method 2
   }
Test class 2(){
   test method 1
   test method 2
   }
 Test class 3(){
   test method 1
   test method 2
   }

I want to be able to run class 1 first then class 2 then class 3 etc. However when I run all tests it's completely random so class 1 method 1 runs first then class 3 method 2. This causes my tests to fail.

I tried using ordered test class in visual studio however I get the following message- MStest V2 based tests cannot be used in an ordered test.

Is there a way for me to order classes so they run in the ordered I need instead of randomly running a test within a class?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Tester_Giant1
  • 101
  • 3
  • 5
  • 1
    Did you see https://stackoverflow.com/questions/20711300/controlling-execution-order-of-unit-tests-in-visual-studio? – MakePeaceGreatAgain Jun 14 '18 at 14:54
  • You can Use Playlist Right click on the test method -> Add to playlist -> New playlist the execution order will be as you add them to the playlist – Dhru 'soni Jun 18 '18 at 13:08

0 Answers0