如何在 Visual Studio Team Services 中 运行 NUnit 测试

How to run NUnit test in Visual Studio Team Services

当我尝试在 VSTS 任务中执行 NUnit 测试时,出现以下错误:

Warning: The path 'C:\a\s\INCASOL.IP\packages' specified in the 'TestAdapterPath' does not contain any test adapters, provide a valid path and try again.

我在 VSTS 中有这些任务:

"Run unit test"任务配置如下:

注意我已经设置了 "Path to Custom Test Adapters"。

我认为 NUnit 的 dll 已正确复制到 packages 文件夹,因为在 "Nuget restore" 任务中我可以看到以下内容:

Added package 'NUnit.2.6.4' to folder 'C:\a\s\INCASOL.IP\packages'

注意:NUnit 版本是 2.6.4,我使用的是 Hosted Agent

在寻找解决方案几个小时后,我在提出问题后几分钟就解决了。 虽然我可以 运行 使用 NUnit 测试适配器在我的本地机器上进行测试,但这个包还没有添加到我的包文件夹中。所以,一旦我 运行

Install-Package NUnitTestAdapter

对于我的测试项目,一切正常。