0

I use NUnit 2.6.4 to test my code, but would like to switch to using something within Visual Studio 2017. I tried NUnitTestAdapter.WithFramework, but realized that clicking "Run All" (Tests) on Test Explorer windows will build my entire solution in an attempt to discover all tests, and not just build the test project I want. When I build only the project I want, Test Explorer will not discover my tests. http://nunit.org/nunitv2/docs/2.6.4/vsTestAdapter.html and https://github.com/Microsoft/vstest/issues/696 seem to imply that building the whole solution triggers the test discovery.

Is there a way to only discover tests of a specific project, like NUnit is able to do?

4

1 回答 1

0

在构建菜单 > 配置管理器中,当您选择构建菜单 > 构建解决方案或测试资源管理器窗口 > 全部运行时,您可以选择在特定配置中运行的项目。您还可以在管理器中添加配置。因此,您可以拥有 "UnitTestsOfAlgorithms" 、 "UnitTestsOfDataTables" 和 "IntegrationTestsOfStateMachine" 、 "Debug" 和 "Release" 配置,所有这些配置都配置为构建解决方案的各个部分,您的团队的不同部分都关心这些部分。

这对我来说不是一个优雅的解决方案,但很有必要。看来您需要在当前配置中构建所有项目才能触发测试发现。

于 2019-08-15T13:42:55.307 回答