Jenkins finds no JUnit report after an iOS test run
No test report files were found. Configuration error?Short answer
The junit step only reads JUnit XML files. A plain xcodebuild test run does not write one, so the step finds nothing and fails the build. Make the test step output JUnit XML into a known folder, then give the step an Ant-style pattern that matches it.
Fix it fast
1Find out which cause you have
Look in the job workspace for XML files after the test stage runs. If the list is empty, the report was never written; if it has files, the pattern is wrong.
find . -name "*.xml" -path "*test*"2Match what you see, then jump to its fix
- 1
The workspace has no XML report at all after the test stageThe test run never wrote a JUnit fileFix - 2
The XML exists in the workspace, but the build still reports no filesThe junit pattern does not match where the file isFix - 3
The failing run is a build or lint job, and no test stage ran before the junit stepA stage that legitimately has no tests runs the step tooFix
- 1
What does the error look like?
No test report files were found. Configuration error?
Cause 1 of 3
The test run never wrote a JUnit file
1Check
The step expects JUnit XML files. Plain test output goes to the console or an Xcode result bundle, and neither is JUnit XML.
grep -rn "scan\|run_tests\|xcodebuild" Fastfile Jenkinsfile2Fix
Run the tests through fastlane's run_tests (scan), whose output_types defaults to html and junit, and set the output_directory so the location is known.
# Fastfile
lane :test do
run_tests(
scheme: "MyApp",
output_types: "junit",
output_directory: "./fastlane/test_output"
)
end3Verify
Run the lane and list the output folder.
bundle exec fastlane test
ls fastlane/test_outputConfirmed by docs.fastlane.tools
Cause 2 of 3
The junit pattern does not match where the file is
1Check
The step takes the path to JUnit XML files in Ant glob syntax, for example a pattern like **/build/test-reports/*.xml, and it should not include non-report files.
find . -name "*.xml" -path "*test_output*"2Fix
Use a glob that matches the folder you set above.
// Jenkinsfile
post {
always {
junit testResults: 'fastlane/test_output/*.xml'
}
}3Verify
Run the job again and open the Test Result page.
# In Jenkins: build page > Test ResultConfirmed by jenkins.io
Cause 3 of 3
A stage that legitimately has no tests runs the step too
1Check
By default, the step fails a build on missing test result files or empty results.
grep -n "junit" Jenkinsfile2Fix
Move the junit step to the stage that runs the tests, or set allowEmptyResults for jobs that may have none.
junit testResults: 'fastlane/test_output/*.xml', allowEmptyResults: true3Verify
Run a job without tests and confirm the build does not fail on the step.
# Jenkins build console: junit step finishes without the errorConfirmed by jenkins.io
How do I stop it coming back?
- Set an explicit output folder for the test step instead of relying on a default.
- Archive the raw test output folder too, so a missing report can be diagnosed from the build page.
- Keep the junit step in the same stage as the tests it reads.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Mobile apps
Cannot change the App Privacy answers in App Store Connect
Publish Your App Privacy Responses?
Only the Account Holder, Admin and App Manager roles can answer the App Privacy questions.
2 causes, each with a fixMobile apps
App record creation fails because you lack permission
You cannot add a new app in App Store Connect as a Developer or limited user
Only the Account Holder, an Admin or an App Manager can create an app record, and Apple blocks it until the Account Holder has signed the latest agreement.
3 causes, each with a fixMobile apps
You cannot find the button to pull your app back from review
No 'remove this version from review' message appears on the version page
There is no button called Reject Binary.
3 causes, each with a fixMobile apps
Your Apple Account cannot sign in to App Store Connect
Sign-in to App Store Connect is refused for an account that should have access
App Store Connect does not open to every Apple Account.
3 causes, each with a fixMobile apps
Apple rejected the app under Guideline 4.3, Design: Spam
Guideline 4.3(b) - Design - Spam
Guideline 4.3 is Apple's duplicate rule.
5 causes, each with a fixMobile apps
App Store Connect rejects a screenshot because it has transparency
Images can't include alpha channels or transparencies.
App Store Connect does not accept screenshots that carry an alpha channel or transparent pixels.
2 causes, each with a fix