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

时间:2018-03-25 16:31:02

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

我正在尝试在命令行上运行我的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我想要运行哪些测试?

1 个答案:

答案 0 :(得分:0)

原来我必须指定正确的文件名:

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

相关问题