To run automated tests in Bitbucket Cloud, add a bitbucket-pipelines.yml file at the repository root and run your test command in a Pipelines step. To display results in Bitbucket, configure your test runner to produce JUnit-style or Maven Surefire XML, then save the report in a supported location or declare it as a test-report artifact.
What you need before configuring tests
- A Bitbucket Cloud repository with Pipelines enabled.
- The test command your team already uses, such as
npm testor a framework-specific command. - A build image containing the required runtime, plus any dependencies or services the tests need.
- If you want results in Bitbucket’s test view, a way to generate supported JUnit-style or Maven Surefire XML.
This guide is for Bitbucket Cloud and Bitbucket Pipelines, not Bitbucket Data Center. The commands and report configuration depend on your project’s language and test framework.
As an Amazon Associate I earn from qualifying purchases.
Add a pipeline that runs your tests
- Create the configuration. Add
bitbucket-pipelines.ymlat the repository root. The file describes which pipeline runs and the commands executed in each step. See Atlassian’s Pipelines getting-started documentation. - Select a build image. Choose a container image with the runtime your project needs. Add commands to install dependencies or prepare services that are not already available in the image.
- Run the test command. Put it under a step’s
script. The example below shows the structure, but it is schematic—not a tested configuration. Replace the image, setup, test command, and report path to match your repository.
image: node:latest
pipelines:
default:
- step:
name: Test
script:
- npm ci
- npm test
artifacts:
- name: Test reports
type: test-reports
paths:
- test-results/*.xml
The pipeline command must actually generate XML in the configured report directory; declaring a path alone does not produce test results. See Atlassian’s configuration guidance for pipeline structure and framework examples.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteMake test results visible in Bitbucket
Generate a supported XML report
Bitbucket Pipelines’ built-in test reporting recognizes JUnit and Maven Surefire XML reports. The test framework and language may differ, but the runner must emit a compatible report for Bitbucket to display failures and related details.
#1 Best Overall
Atlassian’s getting-started documentation shows framework-specific approaches such as PHPUnit’s --log-junit, pytest’s --junit-xml, Jest with jest-junit, and JUnit reporters for Playwright or Cypress. Package names, flags, and configuration can vary by framework version, so use the current documentation for the runner you have installed: Bitbucket Pipelines getting started.
Use a default report path or declare a custom one
Documented report-discovery patterns include ./**/surefire-reports/**/*.xml, ./**/failsafe-reports/**/*.xml, ./**/test-results/**/*.xml, ./**/test-reports/**/*.xml, and ./**/TestResults/**/*.xml. Discovery is subject to a directory-depth limit. If your XML is outside the supported defaults, declare its location under the step’s artifacts with type: test-reports, as in the schematic example. Consult Atlassian’s current report configuration guidance for exact syntax and behavior.
Verify a pipeline run
- Open the pipeline run and confirm the test command executed successfully or failed as expected.
- Check the build logs and workspace output to confirm the XML report was created.
- Open the test results view and confirm it shows the expected failures and details.
Choose a pipeline structure that fits the test suite
One step or several
A single step can be enough for a small suite. For clearer logs and failure ownership, use separate steps for tasks such as build, unit tests, integration tests, and linting. Independent work can run in parallel, provided the tests do not depend on shared mutable state and the pipeline’s runtime and resource constraints allow it. Refer to Atlassian’s parallel-step documentation.
Recommended Free Tools
Rank #2
One environment or a version matrix
Use one build image when you only need to validate one runtime or dependency version. For compatibility coverage, define separate steps with different images. Atlassian documents this cross-platform testing pattern and notes that xUnit-compatible results can appear in the log view; see testing across multiple platforms.
Test reports and other artifacts serve different purposes
Test-report artifacts make compatible XML available for Pipelines test reporting. Other artifacts can preserve failure evidence such as screenshots, videos, and logs. Artifact scope and retention have separate rules, so check Atlassian’s artifact documentation when deciding what to retain.
Troubleshoot missing or incomplete test results
The test results view does not appear
- Confirm Pipelines is enabled. A YAML file alone does not run a pipeline; check the repository’s Pipelines configuration and the run status.
- Confirm the test command ran. Review the step log for a skipped command, an earlier failure, or a different working directory.
- Check the report format. Ensure the runner writes JUnit-style or Maven Surefire XML, rather than only human-readable console output.
- Check the file path and depth. Place reports in a supported default location or declare the custom path under
artifactswithtype: test-reports. - Check that a report file exists. A configured reporter may write nothing when tests do not start or when its output directory differs from the one configured in YAML.
Tests pass but Bitbucket shows no failures or details
Inspect the generated XML itself and confirm it contains the test cases and failure information. Then verify that the XML is under the path pattern Bitbucket is collecting. If the runner’s output is not JUnit or Maven Surefire-compatible, configure an appropriate reporter for that framework.
Rank #3
A pipeline step fails before tests start
Use the first relevant error in the step log to distinguish setup problems from test failures. Check that the image has the expected runtime, dependency installation completed, and any required service or environment variables are configured. A pipeline that stops during setup cannot generate a test report.
Options beyond basic pipeline reporting
Richer test management
Atlassian describes Bitbucket Tests as an open beta with test summaries, flaky-test detection, and quarantine controls. Its documentation says availability is limited to Standard and Premium customers. Beta status and plan eligibility can change, so verify current availability before planning around it: Bitbucket Tests documentation.
Pull-request insights and external test services
Code Insights can surface reports and metrics in pull requests. Atlassian also lists third-party testing integrations, including Sauce Labs, for teams needing hosted browser or device coverage. These are separate from the basic Pipelines test-report workflow; see Code Insights and Atlassian’s testing integrations for current details.
Rank #4
Or skip the browser setup
If a test workflow needs a website screenshot—for example, to inspect a page state—ScreenshotNeo is a website screenshot API and MCP server for developers. It is separate from Bitbucket’s test reporting: use it when a test or AI agent needs a screenshot, not as a replacement for a JUnit report.
One GET request can return an image or PDF. For example, use cURL to save a WebP screenshot:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for parameters and response behavior. ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify page verdict and billing status in headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
The Free plan includes 1,000 screenshots per month without a card. Paid plans start at $5 for 3,000 shots; all features are available on every plan. Sign up for 1,000 free screenshots a month—no card required.
Best Value
Frequently Asked Questions
Does Bitbucket Pipelines require a particular test framework?
No. The test command is project-specific; for built-in result display, the runner must produce a supported JUnit-style or Maven Surefire XML report.
Can Pipelines show a test report stored outside its default paths?
Yes. Declare the custom XML location as a test-report artifact using type: test-reports and the appropriate path pattern.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




