How to Show Test Results in the UI in Bitbucket Pipelines
Bitbucket auto-detects JUnit XML written under test-results/ and renders a Tests tab on the pipeline.
There is no publish task - just emit JUnit XML into the test-results/ glob (or /test-results/**) and Bitbucket parses it automatically after the step.
Emit JUnit XML for auto-detection
Writing the report under test-results/ is all Bitbucket needs to render the Tests view.
bitbucket-pipelines.yml
image: node:20
pipelines:
default:
- step:
name: Test
script:
- npm ci
- npm test -- --reporters=default --reporters=jest-junit
after-script:
- echo "tests done"
# jest-junit configured to output to ./test-results/junit.xmlGotchas
- Bitbucket auto-detects reports under
test-results/**/*.xml- there is no explicit publish step to add. - The report must be JUnit-format XML; other formats are not parsed into the Tests tab.
- Test results are collected even if the step fails, so failing tests still appear - keep the reporter writing on failure.
Related guides
How to Publish Test Results to the UI in Azure PipelinesPublish test results to the Azure Pipelines Tests tab with PublishTestResults@2, using JUnit format and condi…
How to Generate and Store a Coverage Report in Bitbucket PipelinesGenerate code coverage in Bitbucket Pipelines and keep it with artifacts, or upload to Codecov so coverage sh…