Visual Studio使用什么命令行参数来运行MsTest?
我试图找出哪些是由Visual Studio使用时运行MSTest的测试命令行参数,我想它的开头为:Visual Studio使用什么命令行参数来运行MsTest?
MSTest.exe /testmetadata:%SolutionName%.vsmdi /testlist:
但我无法弄清楚如何填补testlist参数,因为无论是测试列表名称和ID出现以下错误:
The test list path 8c43105b-9dc1-4917-a39f-aa66a61bf5b6 cannot be found.
An error occurred while executing the /testlist switch.
I'm trying to figure out which is the command line arguments used by Visual Studio when you run the MsTest tests
这要看你怎么跑从Visual Studio的测试。请参见下面的例子:
-
您从
Test View
窗口中选择一些测试和运行它们MSTest.exe /testcontainer:TestProject.dll /test:TestMethod1 /test:TestMethod2 ...
-
你从
Test View
窗口MSTest.exe /testcontainer:TestProject.dll
-
运行所有测试您已经通过
Test View
窗口筛选了一个类别的测试,并运行此类别MSTest.exe /testcontainer:TestProject.dll /category:CategoryName
-
你已经打开了
*.vsmdi
文件,并选择一些TestLists
运行MSTest.exe /testmetadata:*.vsmdi /testlist:TestList1 /testlist:TestList2 ...
-
您正在运行负载或有序测试
MSTest.exe /testcontainer:LoadTest1.loadtest /testcontainer:OrderedTest1.orderedtest
您可以在上面结合例子(参数)创建MSTest
命令th适合你的情况。您唯一的限制是您不能一起使用/testmetada
和/testcontainer
参数。
至于TestList
参数,你只需要给参数列表的名称。如果找不到,那么您的测试列表不存在,或者它不属于您在/testmetadata
参数中定义的*.vsmdi
。
我相信你已经做了,但你可以查看以下链接: MSTest.exe Command-Line Options
见下link。尽管这篇文章是关于msbuild的。它使用exec任务来调用mstest。 如果您使用/ testlist,您需要提供元数据文件。 您可以使用/ testcontainer并为您的测试项目提供dll。它会运行你所有的测试。
/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