Order test cases using playlist for automation test

424 Views Asked by At

I am using playlists for running test cases in a particular order(which are dependent on one another). The first time I am using playlist it worked correctly. But once I close the visual studio and open again the playlist is not working. Here is my code.

    [TestMethod]
    public void Test2()
    {
      // code
    }
    [TestMethod]      
    public void Test1()
    {
        //code
    }    
     [TestMethod]       
     public void Test3()
     {
         //code
     }

My execution requirement is in Test1,Test2,Test3 manner but it is executing in Test2,Test1,Test3 order. After opening if I remove some test cases from the playlist and add them again from test explorer, then I am getting the desired result (but the issue if I close the solution still exists.). Tried searching on the internet but couldn't find any solution. Couldn't even find a post with similar problem like mine. Hoping someone had the same issue like this. Let me know if you need further information.

1

There are 1 best solutions below

0
joinsaad On

For ordering tests, use "ordered test" present in visual studio. Playlists not meant to create order in your test cases.