Search code examples
c#seleniumazure-devopsnunitmstest

NUnit failed to load MSTestAdapter/MSTestFramework DLLs and "couldnt find any tests"


I am doing a unit test with NUnit and i want to integrate it into azure devops. When i run the test locally in visual studios with test explorer, the tests are able to run properly without failure.

However, when i build it on azure devops, i encounter the problem of NUnit failing to load the MSTestAdapter and MSTestFramework Dlls or it being unable to find MSTestAdapter/MSTestFramework dlls.

Initially when i looked through, i thought it was because my processor architecture did not match.Thus i tried to create a runsettings file and change the test platform to x64 for NUnit to match the test. However, it still didnt work and gave me the same error message (will be shown below)

code in Runsettings file which i have tried :

    ```` <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


Solution

  • Apparently there was something wrong with my visual studios. Not very sure which part of my vs it was that affected my testing, but after reinstalling vs and building from scratch, i am able to build on devops without any error.