how does MSTest determine the order in which to run test methods?

前端 未结 4 487
-上瘾入骨i
-上瘾入骨i 2021-01-01 12:37

edit: note, question 288805 is similar, however, I specifically am asking how does MSTest choose the default test order. Please

4条回答
  •  情书的邮戳
    2021-01-01 12:40

    As for VSTest execution order. Here is how it's organized in your TestProject:

    1. Sort cs-files in your project by their CREATION Time ASC
    2. Method Position in each file

    For example, you have 3 cs files in project.

    • UnitTest1.cs - created 01/01/1970 with methods TestMethod05 and TestMethod03
    • UnitTest2.cs - created 05/01/1970 with method TestMethod02.
    • UnitTest3.cs - created 03/01/1970 with method TestMethod01.

    Then order of executing test is this:

        TestProject1.UnitTest1.TestMethod05
        TestProject1.UnitTest1.TestMethod03
        TestProject1.UnitTest3.TestMethod01
        TestProject1.UnitTest2.TestMethod02
    

    You can see the 'default order' using command:

    vstest.console.exe TestProject1.dll /ListTests

提交回复
热议问题