docs icon indicating copy to clipboard operation
docs copied to clipboard

Nunit3 console exe doesn't output result in nunit2 format even though correct format type is mentioned

Open yonisym opened this issue 10 years ago • 9 comments

I am adding this as my case is closed. Even thought the documentation says it is possible to output result with nunit2 format, nunit3 console exe says it is not supported. Here is the error that I see ----------------------------------------------------------------------

"C:\TestToolAndData\Nunit\nunit3-console.exe" "C:\Test\InternalPortalSeleniumTest.dll" --result=TestResult.xml;format=nunit2 ERROR NUnit Console Runner 3.4.1 Copyright (C) 2016 Charlie Poole

Unknown result format: nunit2

Here is the help link and excerpt from help note --------------------------------------------------

If you read the documentation for 2.6.3, you will see that it does not talk about CLR.BAT, but gives different instructions, http://www.nunit.org/index.php?p=consoleCommandLine&r=2.6.3. You are looking at the 2.2.5 documentation.

For NUnit 3, if you run the console with the --help option, it gives you all of the information you need. --result=SPEC An output SPEC for saving the test results.

Then further down it explains what a SPEC is, Several options that specify processing of XML output take an output specification as a value. A SPEC may take one of the following forms: --OPTION:filename --OPTION:filename;format=formatname --OPTION:filename;transform=xsltfile

  The --result option may use any of the following formats:
      nunit3 - the native XML format for NUnit 3.0
      nunit2 - legacy XML format used by earlier releases of NUnit

  The --explore option may use any of the following formats:
      nunit3 - the native XML format for NUnit 3.0

Combine that and you get --result=TestResult.xml;format=nunit2

yonisym avatar Sep 27 '16 20:09 yonisym

How are you installing NUnit, are you getting the NUnit.ConsoleRunner NuGet package?

The NUnit2 format is packaged separately, as an add-in. The easiest solution is probably to switch to the NUnit Console package, which comes with the add-ins bundled in.

ChrisMaddock avatar Sep 27 '16 20:09 ChrisMaddock

Yes I install it as a package , here is what I get when I try to install it PM> Install-Package NUnit.Console Package 'NUnit.Console.3.4.1' already exists in project 'InternalPortalSeleniumTest' Time Elapsed: 00:00:00.9958985 PM>

where does it store the downloaded console exe ? in programs ?

yonisym avatar Sep 27 '16 20:09 yonisym

Also I check the package folder it has 'NUnit.Console.3.4.1' package .How ever I don't see the nunit3.console.exe where is it getting dropped? I am getting that from c:\programsfolder.

yonisym avatar Sep 27 '16 20:09 yonisym

NUnit.Console is a 'meta-package' - it just pulls in other packages.

You should also have an NUnit.ConsoleRunner package in your packages dir. You'll find nunit3-console.exe inside that - reference that one, which should know about the NUnitv2ResultWriter add-in.

ChrisMaddock avatar Sep 27 '16 20:09 ChrisMaddock

I was installing it from nugget manager , however now I just build the Nunit Console solution locally on my local box the command now accepts the nunit2 format. Man thanks for your help. I wish if you guys put some kind of documentation for this so that others don't suffer. The funny thing is this thing also work from the following package location \packages\NUnit.ConsoleRunner.3.4.0\tools

yonisym avatar Sep 27 '16 21:09 yonisym

I have the same question

tanjaduro avatar Oct 11 '16 14:10 tanjaduro

@tdurova Since the question is answered, we can't do much to help you unless you say what part of the answer is not clear. :-)

CharliePoole avatar Oct 11 '16 14:10 CharliePoole

I had a similar problem and here are my findings:

  • NUnit2 format is in a separate NuGet package NUnit.Extension.NUnitV2ResultWriter
  • NUnit.Console contains NUnit.Extension.NUnitV2ResultWriter
  • NUnit runner locates extensions by *.addins files which contain relative paths to extensions
  • NUnit.ConsoleRunner contains nunit.nuget.addins which allows the runner to use all extensions downloaded as NuGet packages without any intervention

So if you change the folder structure (which was my case) the extension is no longer registered and you have to add your own *.addins file (or modify nunit.nuget.addins) with the relative path to it.

setycz avatar Oct 04 '17 06:10 setycz

Spot on!

This is basically https://github.com/nunit/docs/issues/11 - there's a gap for it here: https://github.com/nunit/docs/wiki/Writing-Engine-Extensions#installing-extensions

@setycz - any chance your fancy writing this up into something we can add to the docs? We'd love the contribution! It would be good to have something about default NuGet behaviour - and then the custom stuff you found - there's more details about that here right now, but it needs writing up into something better!

ChrisMaddock avatar Oct 04 '17 13:10 ChrisMaddock