MsTest.exe 没有找到任何测试

MsTest.exe not finding any tests

我有一个 selenium Specflow c# 项目,我可以在其中从测试资源管理器和通过 ReSharper 单元测试资源管理器执行测试。

但是当我运行命令行执行测试时(Jenkins就是这样执行测试的)

在 DLL 中没有找到任何测试

mstest /testcontainer:MoneyUITests.dll /test:NavigateToLoans
Microsoft (R) Test Execution Command Line Tool Version 15.0.26621.2
Copyright (c) Microsoft Corporation. All rights reserved.

Loading MoneyUITests.dll...
Test NavigateToLoans cannot be found.
Test NavigateToLoans cannot be found.
Starting execution...
No tests to execute.

不确定我做错了什么,visual studio 设法毫无问题地找到并执行测试似乎很奇怪。

这是因为 mstest.exe 在 Visual Studio 2010 年用于测试 自 Visual Studio 2012 年起,您应该使用 VSTest.Console.exe.

您是否尝试过使用 VSTest.Console.exe 而不是 mstest.exe?

我在 Whosebug 上找到了这个答案:Answer on How to run selenium c# test in command prompt?