3

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'.
Andybrad
  • 51
  • 1
  • 4

1 Answers1

6

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".

Andres
  • 121
  • 6
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/29895845) – Muhammedogz Sep 24 '21 at 00:50
  • I have been running this as a PR build. The only changes in my PR are adding test categories: `[TestFixture(Category = "UnitTest")]` and the NunitXml.testLogger package - which has made changes in my packages.config: `` and csproj of my test project: `` – Andybrad Oct 20 '21 at 12:33
  • Would it make a difference if I checked in the NunitXml.TestLogger, then edited the build as in my original screen shot and then run a build (ie not from a PR)? – Andybrad Oct 20 '21 at 12:36