如何在 specflow 测试中使用 xunit 特征标志?

How to use xunit trait flag with specflow tests?

我正在尝试 运行 我的 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 flag/option 来告诉 xUnit 我想要进行哪些测试 运行?

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

.\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