【发布时间】:2019-12-14 06:13:24
【问题描述】:
我正在使用 NUnit 进行单元测试,我想将它集成到 azure devops 中。 当我使用测试资源管理器在视觉工作室本地运行测试时, 测试能够正常运行而不会失败。
但是,当我在 azure devops 上构建它时,我遇到了 NUnit 无法加载 MSTestAdapter 和 MSTestFramework Dll 或无法找到 MSTestAdapter/MSTestFramework dll 的问题。
最初当我查看时,我认为这是因为我的处理器架构不匹配。因此我尝试创建一个运行设置文件并将测试平台更改为 x64 以使 NUnit 匹配测试。 但是,它仍然没有工作,并给了我同样的错误信息(如下所示)
我尝试过的 Runsettings 文件中的代码:
```` <RunSettings>
````<!-- Configurations that affect the Test Framework -->
```` <RunConfiguration>
````<TargetPlatform>x64</TargetPlatform>
```` <TargetFrameWorkVersion>Framework45</TargetFrameWorkVersion>
```` </RunConfiguration>
```` </RunSettings>
Just a part of the error messages
The error message is what i get at the VSTest part in azure devops when i build my project
(the messages are all similar) :
Multiple versions of same extension found. Selecting the highest version.
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter : 14.0.2505.1
Input string was not in a correct format.
Could not load type 'Microsoft.VisualStudio.TestTools.UnitTesting.ExecutionScope' from assembly 'Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'Microsoft.VisualStudio.TestTools.UnitTesting.ExecutionScope' from assembly 'Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Unable to load types from the test source 'd:\a\1\s\MSTest.TestAdapter.1.3.2\build\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll'. Some or all of the tests in this source may not be discovered.
Input string was not in a correct format.
Unable to load types from the test source 'd:\a\1\s\MSTest.TestAdapter.1.3.2\build\uap10.0\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll'. Some or all of the tests in this source may not be discovered.
Input string was not in a correct format.
NUnit Adapter 3.12.0.0: Test execution started
Running all tests in d:\a\1\s\HeyX.UnitTest\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll
NUnit failed to load d:\a\1\s\HeyX.UnitTest\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll
Running all tests in d:\a\1\s\HeyX.UnitTest\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll
NUnit couldn't find any tests in d:\a\1\s\HeyX.UnitTest\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll
Running all tests in d:\a\1\s\HeyX.UnitTest\bin\Debug\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
NUnit couldn't find any tests in d:\a\1\s\HeyX.UnitTest\bin\Debug\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
【问题讨论】:
标签: c# selenium azure-devops nunit mstest