What command line arguments does Visual Studio use to run MsTest?

I'm trying to figure out what command line arguments Visual Studio uses when running the MsTest tests, I think it starts with:

MSTest.exe /testmetadata:%SolutionName%.vsmdi /testlist: 

But I could not figure out how to populate the testlist parameter, because both the name and the identifier of the test list get the following error:

 The test list path 8c43105b-9dc1-4917-a39f-aa66a61bf5b6 cannot be found. An error occurred while executing the /testlist switch. 
+6
command-line-arguments visual-studio-2010 mstest
source share
2 answers

I am trying to figure out what command line arguments are used by Visual Studio when running MsTest tests

It depends on how you run your tests from Visual Studio. See the following examples:

  • You select some tests from the Test View window and run them

     MSTest.exe /testcontainer:TestProject.dll /test:TestMethod1 /test:TestMethod2 ... 
  • You run all tests from the Test View window.

     MSTest.exe /testcontainer:TestProject.dll 
  • You filtered your tests into categories through Test View and ran this category.

     MSTest.exe /testcontainer:TestProject.dll /category:CategoryName 
  • You opened the *.vsmdi file and selected some TestLists to run

     MSTest.exe /testmetadata:*.vsmdi /testlist:TestList1 /testlist:TestList2 ... 
  • Load or order tests are in progress

     MSTest.exe /testcontainer:LoadTest1.loadtest /testcontainer:OrderedTest1.orderedtest 

You can combine the above examples (arguments) to create the MSTest command that suits your case. The only limitation you have is that you cannot use the arguments /testmetada and /testcontainer .

As for the TestList argument, you just need to specify a list name as a parameter. If it is not found, your test list does not exist or does not belong to the *.vsmdi that you specified in the /testmetadata argument.

I am sure that you have already done this, but you can check the following link: MSTest.exe command-line options

+8
source share

See the link. Although this post is about msbuild. It uses the exec task to call mstest. If you use / testlist, you need to provide a metadata file. You can use / testcontainer and provide a dll for your test project. He will conduct all your tests.

 /testcontainer:[file name] Load a file that contains tests. You can Specify this option more than once to load multiple test files. Examples: /testcontainer:mytestproject.dll /testcontainer:loadtest1.loadtest 
0
source share

All Articles