How to obtain and identify on Bamboo Datacenter the list of the test cases for the plans and specific build results

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

The steps outlined in this article are provided AS-IS. This means we've had reports of them working for some customers, under certain circumstances, yet they are not officially supported, nor can we guarantee they'll work for your specific scenario.

You may follow through and validate them on your own non-prod environments prior to production, or fall back to supported alternatives if they don't work out.

We also invite you to contact our Community for matters that are outside Atlassian's scope of support!

The following steps will help you obtain a list of test cases for the build results using the Bamboo UI and the Rest API for a specific Plan/Build combination or using a set of SQL queries to fetch that information from the database.

Environment

The solution has been validated in Bamboo 9.6 but may be applicable to other supported versions.

Solution

Using the UI to access the list of test cases:

To access the test cases on Bamboo, navigate to "Project > Plan > Build #". Once you click on the build number, you'll see a Summary that categorizes all the evaluated tests into 'New Failures,' 'Existing Failures,' 'Fixed,' and 'Quarantined/Skipped'.

Summary of tests for a Bamboo build from Project > Plan > Build #

Navigate to the 'Test' tab on the same page. There, we will find the total number of tests run, more detailed information about the number of tests run, and the reasons for their failures.

Tests tab for a build from Project > Plan > Build #

Refer How to view the detailed test cases inside Bamboo buildresults for more details.

Using the API to access the list of test cases:

Using the command CURL or an app like POSTMAN format the API call like this:

curl -k -u "bamboo_admin":"bamboo_password" 'https://BAMBOO-URL/rest/api/latest/result/<JOB_KEY>-<BUILD#>?expand=testResults.allTests'

Please replace bamboo_admin, bamboo_password, BAMBOO-URL, <JOB_KEY>-<BUILD#> with the values from your Bamboo instance.

More information about the Bamboo REST API refer Bamboo Rest API documentation.

Fragment of the response

http://bamboo-url:8085/rest/api/latest/result/TES-TESR-JOB1-5?expand=testResults.allTests

Example of the output

. . . "testResults": { "expand": "allTests,successfulTests,failedTests,newFailedTests,existingFailedTests,fixedTests,quarantinedTests,skippedTests", "all": 4000, "successful": 2000, "failed": 2000, "newFailed": 2000, "existingFailed": 0, "fixed": 0, "quarantined": 0, "skipped": 2000, "allTests": { "size": 3000, "expand": "testResult", "testResult": [ { "testCaseId": 44240836, "className": "SuccessTests", "methodName": "successTest_1909", "status": "successful" }, { "testCaseId": 44237312, "className": "FailedTests", "methodName": "failedTest_1670", "status": "failed" }, . . .

Using database queries to fetch the list of test cases:

We have broken down the SQL query to provide 3 different lists of test cases.

  1. Number of test cases for a particular build result or for a particular job.

  2. Number of test cases for a plan.

  3. Detailed list of failed and skipped test cases.

Number of test cases for a particular build result or job.

Overall test case-related data

PostgreSQL

SELECT B.FULL_KEY AS plan_key, B.TITLE AS plan_name, BRS.BUILD_STATE, BRS.BUILD_NUMBER, BRS.FAILURE_TEST_COUNT, BRS.SUCCESS_TEST_COUNT, BRS.TOTAL_TEST_COUNT, BRS.BROKEN_TEST_COUNT, BRS.FIXED_TEST_COUNT, BRS.TOTAL_TEST_DURATION, BRS.QUARANTINED_TEST_COUNT, BRS.SKIPPED_TEST_COUNT FROM BUILD B,BUILDRESULTSUMMARY BRS WHERE B.FULL_KEY = BRS.BUILD_KEY AND BRS.BUILD_KEY='TEST-TESR-JOB1' AND BRS.BUILD_NUMBER=4

Please replace TEST-TESR-JOB1 with your Job_key or Plan_key and 4 with the build number for which you want the results.

The result would look something like this:

Output of SQL query to get overall test case-related data for a particular build result or job

In-depth details of the build results with non - successful test cases

Failed and skipped test cases for a particular build

PostgreSQL

SELECT BRS.BUILD_KEY,BRS.BUILD_NUMBER, TC.TEST_CLASS_NAME, TE.TEST_CASE_NAME, TER.TEST_STATE FROM BUILDRESULTSUMMARY BRS, TEST_CLASS TC, TEST_CLASS_RESULT TCR, TEST_CASE TE, TEST_CASE_RESULT TER WHERE BRS.BUILDRESULTSUMMARY_ID = TCR.BUILDRESULTSUMMARY_ID AND TCR.TEST_CLASS_ID=TC.TEST_CLASS_ID AND TCR.TEST_CLASS_RESULT_ID=TER.TEST_CLASS_RESULT_ID AND TER.TEST_CASE_ID=TE.TEST_CASE_ID AND BRS.BUILD_KEY='TEST-TESR-JOB1' AND BRS.BUILD_NUMBER=4

Please replace TEST-TESR-JOB1 and 4 with the right values.

The result would look something like this:

Output of SQL query to get failed and skipped test cases for a particular build in Bamboo

Number of test cases for a plan.

Details of distinct test cases for each Bamboo plan

PostgreSQL

SELECT DISTINCT B.FULL_KEY AS plan_key, B.TITLE AS plan_name, COUNT(*) AS distinct_test_cases FROM BUILD B, TEST_CLASS TC, TEST_CASE TCA WHERE B.BUILD_ID = TC.PLAN_ID AND TC.TEST_CLASS_ID = TCA.TEST_CLASS_ID AND B.BUILD_TYPE = 'CHAIN' GROUP BY B.BUILD_ID, B.BUILDKEY, B.FULL_KEY ORDER BY PLAN_KEY, COUNT(*)DESC

The result would look something like this:

Output of SQL query to get details of distinct test cases for each Bamboo plan

The queries have been tested in PostgreSQL DB and should work properly for other DB Types as well, If you are having issues running the query for other DB's please correct the syntax.

Updated on June 30, 2025

Still need help?

The Atlassian Community is here for you.