且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Visual Studio使用哪些命令行参数来运行MsTest?

更新时间:2023-11-28 13:17:58

我正在尝试找出由哪个命令行参数使用 在运行MsTest测试时使用Visual Studio

I'm trying to figure out which is the command line arguments used by Visual Studio when you run the MsTest tests

这取决于您如何从Visual Studio运行测试.请参见以下示例:

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

  1. 您正在从Test View窗口中选择一些测试并运行它们

  1. You are selecting some tests from the Test View window and run them

MSTest.exe /testcontainer:TestProject.dll /test:TestMethod1 /test:TestMethod2 ...

  • 您正在从Test View窗口运行所有测试

  • Your are running all the tests from the Test View window

    MSTest.exe /testcontainer:TestProject.dll 
    

  • 您已经通过Test View窗口按类别过滤了测试,并运行了该类别

  • You have filtered your tests by a category through Test View window and run this category

    MSTest.exe /testcontainer:TestProject.dll /category:CategoryName
    

  • 您已打开*.vsmdi文件并选择了一些TestLists来运行

  • You have opened the *.vsmdi file and selected some TestLists to run

    MSTest.exe /testmetadata:*.vsmdi /testlist:TestList1 /testlist:TestList2 ...
    

  • 您正在运行负载测试或有序测试

  • You are running Load or Ordered tests

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

  • 您可以结合以上示例(参数)来创建适合您情况的MSTest命令.唯一的限制是不能同时使用/testmetada/testcontainer参数.

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

    对于TestList参数,您只需要提供列表名称作为参数即可.如果找不到,则您的测试列表不存在,或者不属于您在/testmetadata参数上定义的*.vsmdi.

    As for the TestList argument you just need to give as parameter the name of the list. If it is not found then your test list does not exist or it does not belong to the *.vsmdi you have defined on the /testmetadata argument.

    我确定您已经完成了,但是您可以检查以下链接: MSTest.exe命令行选项

    I am sure that you have already done it, but you can check the following link: MSTest.exe Command-Line Options