spectral icon indicating copy to clipboard operation
spectral copied to clipboard

JUnit format should include all passed tests in order to have an accurate failure rate

Open chrif opened this issue 3 years ago • 3 comments

In Azure Pipelines, it makes much more sense to have test results with all passed tests along with the failed ones. We want to publish results even when they pass. And we want to know what percentage of tests failed. Right now if no tests failed, we get an empty xml file:

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
</testsuites>

And when they fail, it includes only the failed ones, so the failure rate is always either 100% or no results to publish.

chrif avatar Mar 22 '21 15:03 chrif

I'd also like to request warnings added to JUnit output.

jrhorn424 avatar Jun 14 '21 22:06 jrhorn424

I'd also like to request warnings added to JUnit output.

This is possible by defining the fail-severity option of the command line. It seems it is set to error when the format is defined. Setting it to warn will do the work for your case. In your case the command line will look like this:

spectral lint <path_to_api_file> --format junit --output spectral-report.xml --fail-severity warn

ShauniArima avatar Sep 26 '22 15:09 ShauniArima

I'd also like to request warnings added to JUnit output.

This is possible by defining the fail-severity option of the command line. It seems it is set to error when the format is defined. Setting it to warn will do the work for your case. In your case the command line will look like this:

spectral lint <path_to_api_file> --format junit --output spectral-report.xml --fail-severity warn

That is true, but this just adds the warnings as <failure>. Everything below error should be added as <testcase> (see JUnit XML format).

Corbie-42 avatar Mar 08 '23 09:03 Corbie-42