Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'nunit'

12.4k views Asked by At

I am trying create a nunit test results xml file and attach it to a test run of my build in dev ops. I have the NUnit3TestAdapter.3.13.0 package installed in my test project and reference this in console options of the VS test task (test task is version 2).

packages.config: enter image description here

enter image description here

I have tried various combinations in the "other console options" field including "/TestAdapterPath:." or not stating the test adapter path at all. I have also tried moving the test adapter part into the "path to custom test adapters" field as "$(Build.SourcesDirectory)\packages\NUnit3TestAdapter.3.13.0\build\net35". However, each time the tests task returns the error:

Microsoft (R) Test Execution Command Line Tool Version 16.9.1
Copyright (c) Microsoft Corporation.  All rights reserved.
vstest.console.exe "C:\VSTSBuild\agentB\_work\2\s\SomeService.Tests\bin\SomeService.Tests.dll"
/Settings:"C:\VSTSBuild\agentB\_work\_temp\41oiukcwga4.tmp.runsettings"
/EnableCodeCoverage
/Logger:"trx"
/TestAdapterPath:"C:\VSTSBuild\agentB\_work\2\s"
/logger:nunit /TestAdapterPath:C:\VSTSBuild\agentB\_work\2\s\packages\NUnit3TestAdapter.3.13.0\build\net35
Starting test execution, please wait...
##[error]Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'nunit'.
2

There are 2 answers

3
Andres On

That same error was solved on my end by adding a reference to this NuGet package:

NunitXml.TestLogger

Its description is: Xml logger for NUnit v3 compliant xml report when test is running with "dotnet test" or "dotnet vstest".

0
beaucequebec On

I encounter the same issue for Xunit. You need to add package XunitXml.TestLogger