【问题标题】:How to use xunit trait flag with specflow tests?如何在 specflow 测试中使用 xunit 特征标志?
【发布时间】:2018-09-03 19:29:33
【问题描述】:

我正在尝试在命令行上运行我的 SpecFlow/xUnit 测试,如下所述:

http://gasparnagy.com/2016/02/running-specflow-scenarios-in-parallel-with-xunit-v2/

如果我输入这个:

.\packages\xunit.runner.console.2.3.1\tools\net452\xunit.console.exe --help

描述的标志之一是:

-trait "name=value"    : only run tests with matching name/value traits
                       : if specified more than once, acts as an OR operation

我有一个带有 @justthisone 特征的 SpecFlow 场景,我想自己运行它。 Visual Studio 测试资源管理器将此列为具有 Category [justthisone] 的特征我已经尝试过:

.\packages\xunit.runner.console.2.3.1\tools\net452\xunit.console.exe .\MyProj.Tests\bin\Debug\MyProj.Tests.dll -trait "name=justthisone"

但我得到了这个输出:

=== TEST EXECUTION SUMMARY ===
   Order.UserInterface.Tests.dll  Total: 0

我应该如何编写 -trait 标志/选项来告诉 xUnit 我要运行哪些测试?

【问题讨论】:

    标签: command-line automated-tests traits specflow xunit


    【解决方案1】:

    原来我只需要指定正确的文件名:

    .\packages\xunit.runner.console.2.3.1\tools\net452\xunit.console.exe .\MyProj.Tests\bin\Debug\MyProj.Tests.dll -trait "**Category**=justthisone"
    

    如下图:

    https://github.com/techtalk/SpecFlow/issues/938

    【讨论】:

      猜你喜欢
      • 2018-08-31
      • 1970-01-01
      • 2018-05-27
      • 2023-03-14
      • 2016-12-19
      • 1970-01-01
      • 2016-07-21
      • 2019-06-09
      • 1970-01-01
      相关资源
      最近更新 更多