【问题标题】:What command line arguments does Visual Studio use for running MsTest?Visual Studio 使用哪些命令行参数来运行 MsTest?
【发布时间】:2012-05-25 18:26:01
【问题描述】:

我试图找出 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.

【问题讨论】:

    标签: visual-studio-2010 mstest command-line-arguments


    【解决方案1】:

    我试图找出哪个是命令行参数 运行 MsTest 测试时的 Visual Studio

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

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

      MSTest.exe /testcontainer:TestProject.dll /test:TestMethod1 /test:TestMethod2 ...
      
    2. 您正在从 Test View 窗口运行所有测试

      MSTest.exe /testcontainer:TestProject.dll 
      
    3. 您已通过Test View 窗口按类别过滤测试并运行此类别

      MSTest.exe /testcontainer:TestProject.dll /category:CategoryName
      
    4. 您已经打开了*.vsmdi 文件并选择了一些TestLists 来运行

      MSTest.exe /testmetadata:*.vsmdi /testlist:TestList1 /testlist:TestList2 ...
      
    5. 您正在运行 Load 或 Ordered 测试

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

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

    至于TestList 参数,您只需将列表名称作为参数提供。如果没有找到,那么您的测试列表不存在,或者它不属于您在 /testmetadata 参数上定义的 *.vsmdi

    我确定您已经完成了,但您可以查看以下链接: MSTest.exe Command-Line Options

    【讨论】:

    【解决方案2】:

    请参阅以下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
    

    【讨论】:

      猜你喜欢
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-30
      相关资源
      最近更新 更多