Jenkins "none of the test reports contained any results" (junit) in CI
The junit step found no test result XML that it could parse: either the glob matched nothing, the files were empty, or they were older than the build. By default the step fails the build to flag that tests did not actually produce results.
What this error means
The build fails (or goes UNSTABLE) with Test reports were found but none of them are new or none of the test reports contained any results, even though the test command appeared to run.
[Pipeline] junit
Recording test results
ERROR: Step 'Publish JUnit test result report' failed:
None of the test reports contained any results.Common causes
The glob does not match the report path
The testResults pattern points at the wrong directory, or the test runner wrote reports somewhere else, so no files match.
Tests did not run or produced empty reports
The test step exited before generating XML (a crash, no tests selected), leaving empty or absent reports for junit to read.
How to fix it
Point junit at the real report files
- List the workspace to find where the test XML was written.
- Set
testResultsto a glob that matches those files (relative to the workspace). - Ensure the test step actually ran and produced non-empty reports before
junit.
junit testResults: '**/build/test-results/**/*.xml', allowEmptyResults: falseHow to prevent it
- Generate test reports in a known directory and match it precisely.
- Run the test step before
junit, not in a branch that may be skipped. - Use
allowEmptyResults: trueonly when an empty run is genuinely acceptable.