JunitXml.TestLogger 4.0.254
JUnit Test Logger
JUnit xml report extension for Visual Studio Test Platform.
Packages
Logger | Stable Package | Pre-release Package |
---|---|---|
JUnit |
If you're looking for Nunit
or Xunit
loggers, please see https://github.com/spekt/testlogger.
Usage
The JUnit Test Logger generates xml reports in the Ant Junit Format, which the JUnit 5 repository refers to as the de-facto standard. While the generated xml complies with that schema, it does not contain values in every case. For example, the logger currently does not log any properties
. Please refer to a sample file to see an example. If you find that the format is missing data required by your CI/CD system, please open an issue or PR.
To use the logger, follow these steps:
Add a reference to the JUnit Logger nuget package in test project
Use the following command line in tests
> dotnet test --logger:junit
Test results are generated in the
TestResults
directory relative to thetest.csproj
A path for the report file can be specified as follows:
> dotnet test --logger:"junit;LogFilePath=test-result.xml"
test-result.xml
will be generated in the same directory as test.csproj
.
Note: the arguments to --logger
should be in quotes since ;
is treated as a command delimiter in shell.
All common options to the logger are documented in the wiki. E.g.
token expansion for {assembly}
or {framework}
in result file. If you are writing multiple
files to the same directory or testing multiple frameworks, these options can prevent
test logs from over-writing each other.
Customizing Junit XML Contents
There are several options to customize how the junit xml is populated. These options exist to provide additional control over the xml file so that the logged test results can be optimized for different CI/CD systems.
Platform Specific Recommendations:
After the logger name, command line arguments are provided as key/value pairs with the following general format. Note the quotes are required and key names are case sensitive.
> dotnet test --test-adapter-path:. --logger:"junit;key1=value1;key2=value2"
MethodFormat
This option alters the testcase name
attribute. By default, this contains only the method. Class, will add the class to the name. Full, will add the assembly/namespace/class to the method.
We recommend this option for GitLab users.
Allowed Values
- MethodFormat=Default
- MethodFormat=Class
- MethodFormat=Full
FailureBodyFormat
When set to default, the body of a failure
element will contain only the exception which is captured by vstest. Verbose will prepend the body with 'Expected X, Actual Y' similar to how it is displayed in the standard test output. 'Expected X, Actual Y' are normally only contained in the failure message. Additionally, Verbose will include standard output from the test in the failure message.
We recommend this option for GitLab and CircleCI users.
Allowed Values
- FailureBodyFormat=Default
- FailureBodyFormat=Verbose
License
MIT
No packages depend on JunitXml.TestLogger.
Version | Downloads | Last updated |
---|---|---|
4.1.0 | 25 | 10/12/2024 |
4.0.254 | 205 | 07/29/2024 |
3.1.12 | 473 | 03/25/2024 |
3.0.134 | 21 | 03/29/2024 |
3.0.124 | 7 | 03/29/2024 |
3.0.114 | 7 | 04/29/2024 |
3.0.110 | 6 | 03/29/2024 |
3.0.98 | 5 | 03/30/2024 |
3.0.87 | 4 | 05/28/2024 |
2.1.81 | 6 | 04/28/2024 |
2.1.78 | 7 | 03/29/2024 |
2.1.32 | 6 | 03/30/2024 |
2.1.15 | 17 | 03/30/2024 |
2.1.10 | 7 | 03/30/2024 |