Bitbucket is getting a new navigation

We’re rolling out these changes, so the documentation may not match your experience in the Bitbucket Cloud app. Read about the new Bitbucket navigation

View and add tags to your tests

Tests is in open beta and available to Bitbucket Pipelines customers on Standard and Premium plans.

View tags in your tests

Any user with ‘read’ access to the repository can view the test results in the pipeline's log panel. If failed test results are found, the log view will change to highlight the failed tests, displaying the reason and the stack trace, if present. The full log view is also available using the Build tab.

The Tests tab will only show if you have failed tests to review.

失敗したテストの制限

  • 最初の 100 件の失敗したテスト結果のみが表示されます。

Users with read access to the repository on paid plans can view all the tests in the Test management tab through two connected views: Test summaries and Test executions.

  • The Test Summaries view aggregates of the last 250 tests that were executed over the past 90 days of runs for each test and displays key insights, such as failure rate, average duration, and execution time variance. This helps you quickly identify frequently failing, slow, or unstable tests. You can search by test name or prefix and filter by labels or test state: OK, Flaky, or Quarantine. Read about flaky test management and quarantining tests.

  • Select a test to open its Test executions history, which includes each run's build, commit, execution time, duration, and pass or fail status. This makes it easy to trace when a problem started, link it to a specific change, and track performance over time.

  1. Go to your Bitbucket repository and select Test management.

  2. Review the Test summaries page to see aggregated data for each test, including failure rate, average duration, and variance duration.

  3. Select a test summary to view detailed test executions for that test, including buildNumber, commit message, lastExecuted, execution duration, and outcome.

In the table, you can also sort by average time, failure rate, and variance, and discover tests based on tags.

How tags work in tests

In Bitbucket Pipelines Tests, tags are custom key–value pairs that you add at the test or suite level in your JUnit XML reports. Tags help you:

  • Group tests by ownership (for example, team=payments or owner=zenith)

  • Classify tests by speed (for example, speed=FAST or speed=FULL)

  • Mark tests by purpose or stage (for example, stage=pre-commit, stage=pre-deploy)

  • Associate tests with Jira issues (for example, jira=CICD-1231)

If your repository uses multiple test frameworks, you can create tags for each framework to make it easier to filter and compare tests across them.

On the Tests page, tags appear in a dedicated Tags column for each test summary. Bitbucket Pipelines reads these tags directly from your JUnit-XML reports when they are present.

The Tests feature stores the tag for the test from its latest execution only, which means you can only filter for the most recent or latest (updated or changed) tags.

Add tags to tests

Different test frameworks expose tagging in different ways. For example, some let you add tags via code annotations or decorators, others use test metadata APIs, and some rely on build or reporter configuration (for example, Maven Surefire or mocha-junit-reporter).

The table shows whether the test framework supports adding tags at the suite and/or test level. Tags at the suite level apply to all tests in that suite. Test case level tags apply only to a specific test. Common patterns include annotations (for example, JUnit/TestNG), decorators (for example, pytest), in-test helpers or metadata APIs (for example, WebdriverIO addProperty), and reporter or build configuration (for example, Maven Surefire, mocha-junit-reporter).

If a framework doesn’t support test-level tags natively, you can usually set suite-level properties in the test runner or CI config so they appear in the JUnit XML properties.

Tags with the key prefix bbc.summary.<key> are picked by the test management system, so users must ensure tags with the appropriate prefix are added.

Framework

Native Tag Support

Suite Level

Test Case Level

コメント

Maven/JUnit

はい

example

いいえ

 

Jest

いいえ

いいえ

いいえ

 

Mocha

はい

example

いいえ

 

Cypress

はい

example

いいえ

Use mocha junit reporter.

Playwright

いいえ

いいえ

いいえ

 

Pytest

いいえ

いいえ

いいえ

Currently request to add tags to a test is an open issue and no official support from Pytest. Ref

Nunit

いいえ

いいえ

いいえ

Not supported. Ref

TestCafe

いいえ

いいえ

いいえ

 

WebdriverIO

はい

いいえ

example

 

Maven (JUnit/TestNG)

Suite Level

You can use -D with maven command to add tags for every test run by surefire.

mvn test -Dbbc.summary.test-framework=junit -Dbbc.summary.severity=critical

Or, set them in maven pom config under surefire plugin.

# pom.xml (snippet) <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemPropertyVariables> <bbc.summary.test-framework>junit</bbc.summary.test-framework> </systemPropertyVariables> </configuration> </plugin>

Alternatively, to add tags for specific suites, use System.setProperty in the specific Java class or suite:

@BeforeEach void setUp() { System.setProperty("bbc.summary.severity", "high"); System.setProperty("bbc.summary.owner", "Zenith"); }

Resulting JUnit XML:

This XML file does not appear to have any style information associated with it. The document tree is shown below. <testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="com.example.calculator.CalculatorWithTwoLabelsTest" time="0.01" tests="1" errors="0" skipped="0" failures="0"> <properties> ... <property name="bbc.summary.severity" value="high"/> <property name="bbc.summary.owner" value="zenith"/> </properties> <testcase name="testPercentageCalculationMultipleLabels" classname="com.example.calculator.CalculatorWithTwoLabelsTest" time="0"/> </testsuite>

Mocha

Suite Level

Pass properties via environment variable:

PROPERTIES=bbc.summary.test-framework: MOCHA mocha test --reporter mocha-junit-reporter

参照:

Resulting JUnit XML:

<?xml version="1.0" encoding="UTF-8"?> <testsuites name="Mocha Tests" time="0.005" tests="28" failures="0"> <testsuite name="Root Suite" timestamp="2025-11-12T11:29:09" tests="0" time="0.000" failures="0"> <properties> <property name="bbc.summary.test-framework" value="MOCHA"/> </properties> </testsuite> <testsuite name="Calculator" timestamp="2025-11-12T11:29:09" tests="0" file="/Users/pthakkar3/workspace/test-management-mocha/test/calculator.test.js" time="0.000" failures="0"> <properties> <property name="bbc.summary.test-framework" value="MOCHA"/> </properties> </testsuite> <testsuite name="Addition" timestamp="2025-11-12T11:29:09" tests="5" file="/Users/pthakkar3/workspace/test-management-mocha/test/calculator.test.js" time="0.002" failures="0"> <properties> <property name="bbc.summary.test-framework" value="MOCHA"/> </properties> <testcase name="Calculator Addition should add two positive numbers correctly" time="0.000" classname="should add two positive numbers correctly"> </testcase> <testcase name="Calculator Addition should add two negative numbers correctly" time="0.000" classname="should add two negative numbers correctly"> </testcase> <testcase name="Calculator Addition should add positive and negative numbers correctly" time="0.000" classname="should add positive and negative numbers correctly"> </testcase> <testcase name="Calculator Addition should add decimal numbers correctly" time="0.000" classname="should add decimal numbers correctly"> </testcase> <testcase name="Calculator Addition should throw error for non-numeric inputs" time="0.000" classname="should throw error for non-numeric inputs"> </testcase> </testsuite> ... </testsuites>%

Cypress

Suite Level

Add tags under the properties section in reporterOptions in cypress.config.js, like in the example below:

const { defineConfig } = require('cypress'); module.exports = defineConfig({ e2e: { baseUrl: 'http://localhost:8080', specPattern: 'cypress/e2e/**/*.cy.js', supportFile: false, }, reporter: 'mocha-junit-reporter', reporterOptions: { // Write test reports to repo-root/test-reports/junit for Bitbucket analytics mochaFile: '../test-reports/junit/test-results-[hash].xml', testsuitesTitle: true, suiteTitleSeparatedBy: ' / ', properties: { 'bbc.summary.test-framework': 'Cypress' } }, });

Resulting JUnit XML:

<?xml version="1.0" encoding="UTF-8"?> <testsuites name="true" time="2.201" tests="5" failures="0" skipped="1"> <testsuite name="CypressTests" timestamp="2025-11-26T06:40:29" tests="0" file="cypress/e2e/calculator.cy.js" time="0.000" failures="0"> <properties> <property name="bbc.summary.test-framework" value="Cypress"/> </properties> </testsuite> <testsuite name="Calculator App" timestamp="2025-11-26T06:40:29" tests="5" time="2.201" failures="0"> <properties> <property name="bbc.summary.test-framework" value="Cypress"/> </properties> <testcase name="Calculator App adds numbers" time="0.562" classname="adds numbers"> </testcase> <testcase name="Calculator App multiplies numbers" time="0.513" classname="multiplies numbers"> </testcase> <testcase name="Calculator App divides numbers" time="0.528" classname="divides numbers"> </testcase> <testcase name="Calculator App handles divide by zero" time="0.522" classname="handles divide by zero"> </testcase> </testsuite> </testsuites>%

WebdriverIO

Test case level

Use addProperty method inside your test to add a tag.

import { addProperty } from '@wdio/junit-reporter' describe('Suite', () => { it('Case', () => { addProperty('test_case', 'TC-1234') }) })

Resulting JUnit XML:

<testsuite name="Suite"> <testcase classname="chrome.Case" name="Suite Case"> <properties> <property name="test_case" value="TC-1234" /> </properties> </testcase> </testsuite>

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。