This repository aims to demonstrate an error in the NUnit3 Console, specifically when passing an invalid assembly as a first argument. The error leads to the absence of a version number in the Nunit2 format test output XML generated by the NUnit3 Console.
This can cause downstream effects such as; failing CI pipelines that use the Jenkins Xunit Publishing plugin.
To reproduce this error, follow these steps:
-
Navigate to the Repository after Cloning:
cd NUnitOutputVersionIssue
-
Ensure NUnit3 Console is Installed: Ensure that NUnit3 Console is installed on your system. This test assumes a version greater than
3.15.0. I have been able to reproduce using versions3.15.4,3.16.0&3.17.0:choco install nunit-console-runner
-
Ensure NUnit V2 Result Writer is Installed: Ensure that the NUnit V2 Result Write is installed on your system. This test used version NUnit V2 Result Writer 3.7.0:
choco install nunit-extension-nunit-v2-result-writer
-
Build the Solution: Ensure the solution is built to produce the dlls we will use as inputs into the NUnit3-Console:
dotnet build .\NUnitOutputVersionIssue.sln
-
Run NUnit3 Console with an Invalid Assembly: Execute the following command, notice the name of the invalid assembly at the front:
nunit3-console NUnitOutputVersionIssueB\bin\Debug\NUnitOutputVersionIssueCC.dll NUnitOutputVersionIssue\bin\Debug\NUnitOutputVersionIssue.dll -result TestA.xml;format=nunit2
-
Observe the Output XML: After running the command, observe the test output XML generated by NUnit3 Console. Note the absence of a version number in the XML file.
-
Run NUnit3 Console with Valid Assemblies: To contrast, execute the following command with valid assemblies:
nunit3-console NUnitOutputVersionIssueB\bin\Debug\NUnitOutputVersionIssueB.dll NUnitOutputVersionIssue\bin\Debug\NUnitOutputVersionIssue.dll -result TestB.xml;format=nunit2
-
Observe the Output XML: After running the command, observe the test output XML generated by NUnit3 Console. Note the presence of a version number in the XML file.
-
Run NUnit3 Console with an Invalid Assembly provided secondly: Execute the following command, swapping positions of the invalid assembly with the valid one:
nunit3-console NUnitOutputVersionIssue\bin\Debug\NUnitOutputVersionIssue.dll NUnitOutputVersionIssueB\bin\Debug\NUnitOutputVersionIssueCC.dll -result TestC.xml;format=nunit2
-
Observe the Output XML: After running the command, observe the test output XML generated by NUnit3 Console. Note the presence of a version number in the XML file.
The expected outcome is to observe that when an invalid assembly is passed to NUnit3 Console paired with a valid assembly, the resulting test output XML file should contain a version number. However, the demonstrated error will show the absence of this version number.
- This project is using .NET Framework 4.7.2
- Ensure that the invalid assembly provided is indeed invalid to reproduce the error accurately.
- This repository serves as a minimal setup to reproduce the error and can be expanded upon for further investigation or testing purposes.
- Link to GitHub Issue
- It's possible that this could've been introduced before version
3.15.0, I haven't tested on any earlier versions.