How to obtain and identify on Bamboo Datacenter the list of the test cases for the plans and specific buildresults
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet 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 reach out to our Community for matters that fall beyond Atlassian's scope of support!
Summary
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'.
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.
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
Using database queries to fetch the list of test cases:
We have broken down the SQL query to provide 3 different list of test cases.
- Number of test cases for a particular build result or for a particular job.
- Number of test cases for a plan.
- Detailed list of failed and skipped test cases.
Number of test cases for a particular build result or job.
In-depth details of the build results with non - successful test cases
Number of test cases for a 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.