同时安装NUnit 2.6.4和3.0.0测试适配器:如何防止两者同时运行?

问题描述 投票:1回答:1

我正在使用Visual Studio 2013。

假设我有一个1.0版本的产品,目前正在使用NUnit测试适配器。

我现在想将v1.0移动到分支并开始处理v1.1。我想从NUnit 2.6.4升级到NUnit 3.0.0 for v1.1,但继续使用NUnit 2.6.4 for v1.0修补程序。

为此,我将测试项目升级到NUnit 3.0.0并安装新的NUnit 3测试适配器,以便测试显示在测试资源管理器中。

我现在同时安装并启用了NUnit测试适配器和NUnit 3测试适配器扩展。

结果是当我运行v1.0的单元测试时,我在Output窗口中得到以下内容:

------ Run test started ------
NUnit VS Adapter 2.0.0.0 executing tests is started
Loading tests from c:\MyApplication\_test\MyApplication.Test\bin\MyApplication.Test.dll
Run started: c:\MyApplication\_test\MyApplication.Test\bin\MyApplication.Test.dll
NUnit VS Adapter 2.0.0.0 executing tests is finished

NUnit Adapter 3.0.7.0 executing tests is started
Running all tests in c:\MyApplication\_test\MyApplication.Test\bin\MyApplication.Test.dll
NUnit failed to load c:\MyApplication\_test\MyApplication.Test\bin\MyApplication.Test.dll
========== Run test finished: 137 run (0:00:07,356) ==========

当我打开v1.1解决方案并运行测试时,我得到以下内容:

------ Run test started ------
NUnit VS Adapter 2.0.0.0 executing tests is started
Exception NUnit.Core.UnsupportedFrameworkException, Exception thrown executing tests in C:\MyApplication11\_test\MyApplication.Test\bin\MyApplication.Test.dll
NUnit VS Adapter 2.0.0.0 executing tests is finished

NUnit Adapter 3.0.7.0 executing tests is started
Running all tests in C:\MyApplication11\_test\MyApplication.Test\bin\MyApplication.Test.dll
Loading tests from C:\MyApplication11\_test\MyApplication.Test\bin\MyApplication.Test.dll
NUnit Adapter 3.0.7.0 executing tests is finished
========== Run test finished: 136 run (0:00:08,224) ==========

是否可以同时安装和启用两个测试适配器,以支持两种使用不同版本NUnit的解决方案?

换句话说,我希望能够在不必禁用不适合当前加载的解决方案的测试适配器的情况下在解决方案之间切换。

每个VS2013解决方案是否都可以配置为仅使用特定的测试适配器?

unit-testing visual-studio-2013 nunit
1个回答
0
投票

您可以从VSTest运行单元测试。并通过设置/ TestAdapterPath:[path]命令行选项指定适配器。

© www.soinside.com 2019 - 2024. All rights reserved.