4

我正在尝试在我的代码中调用 3 个 TestCategory 中的一个

测试类别是:-

[TestCategory("SystemOne"), TestCategory("FunctionalTest"), TestCategory("RegressionTest"), TestCategory("Sanity")

调用测试类别的VSTest代码是:

"cmd.exe" "/c vstest.console.exe $automationDLL /Settings:$automationRunSetting /TestCaseFilter:TestCategory=Sanity /logger:trx"

VSTest代码仅TestCaseFilter:TestCategory=SystemOne在即第一个TestCategory 时有效。我无法调用 Sanity TestCategory ieTestCaseFilter:TestCategory=Sanity等等

4

1 回答 1

0

在我的机器上工作正常。您是否阅读过有关 TestCaseFilter 限制的信息?

Visual Studio 中的 MSTest 适配器也可以在旧模式下工作(相当于使用 mstest.exe 运行测试)以实现兼容性。在旧模式下,它无法利用 TestCaseFilter 功能。当指定 testsettings 文件、在 runsettings 文件中将 forcelegacymode 设置为 true 或使用 HostType 等属性时,适配器可以切换到旧模式。

和:

/TestCaseFilter 命令行选项不能与 /Tests 命令行选项一起使用。

尝试在没有/Settings选项的情况下运行它。

于 2019-05-15T10:19:18.753 回答