【问题标题】:how to run more than one test from command line using nunit console runner?如何使用 nunit 控制台运行程序从命令行运行多个测试?
【发布时间】:2021-06-11 13:53:38
【问题描述】:

当我尝试使用以下语法从 Jenkins 或本地命令行运行时,我有失败的测试列表(属于不同的类、命名空间)

.\packages\NUnit.ConsoleRunner.3.10.0\tools\nunit3-console.exe --其中 test==failedTest1,failedTest2,failedTest3 .\ABCTesting\bin\Debug\Api.IntegrationTesting.dll

输出 运行设置 DisposeRunners:真 工作目录:C:\API_IntegrationTesting ImageRuntimeVersion:4.0.30319 ImageTargetFrameworkName: .NETFramework,Version=v4.7.2 ImageRequiresX86:错误 ImageRequiresDefaultAppDomainAssemblyResolver: False NumberOfTestWorkers:12

测试运行摘要 总成绩:通过 测试计数:0,通过:0,失败:0,警告:0,不确定:0,跳过:0 开始时间:2021-06-10 20:43:49Z 结束时间:2021-06-10 20:43:52Z 持续时间:2.574 秒

【问题讨论】:

    标签: jenkins nunit


    【解决方案1】:

    where 子句的语法有两个基本问题...

    1. 逗号 (',') 在 where 子句中不起作用。因此,您告诉 NUnit 查找名为“failedTest1,failedTest2,failedTest3”的测试。 <g> 很可能您没有该名称的测试。

    2. test 操作数指定为测试的FullName,即命名空间和实际测试名称。

    因此,您示例中的正确语法可能是...

    --where "test==My.Namespace.failedTest1 || test==My.Namespace.failedTest2 || test==My.Namespace.failedTest3"
    

    作为一种替代方法,您可能需要考虑使用--testlist 选项,该选项允许您将测试名称放在文本文件中,每行一个全名。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-03
      • 2010-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多