---
title: "Get tests executed in the given build."
method: GET
path: "/api/tests/build/{id}"
tags: ["Tests", "Develocity"]
---

# Get tests executed in the given build.

`GET /api/tests/build/{id}`

## Request

- Base URL: `https://develocity.example.com`
- URL: `https://develocity.example.com/api/tests/build/{id}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/develocity/apis/develocity-api/docs/api/tests/build/:id/get.ts> (a function with typed inputs; its response is checked against the schema)

Retrieves summary of executed tests and containers, as well as the detailed information about each test execution in each invoked test work unit.

## Path parameters

- `id` string, required

## Query parameters

- `query` BuildTestsQuery, required
  - `workUnit` string: The name of the test work unit to return test results for. If not specified, all work units are included. May contain wildcards: an asterisk character ("*") matches an arbitrary number of characters.
  - `testName` string: The name of the test case or container to return test results for. If not specified, all tests and containers are included. May contain wildcards: an asterisk character ("*") matches an arbitrary number of characters. The first matching test and all of its children are returned regardless of whether their names match the query or not.
  - `testOutcomes` TestOutcome[]: Allows restricting the search to tests that had the given outcome. If not specified or empty, all tests and containers are included. If the field contains multiple outcome values, then tests and containers having any of the provided outcomes are returned. For test cases, the overall outcome is inspected. For test containers, their own outcome is inspected. The filter is applied to the leaves of the test hierarchy first. The deepest test or container with matching outcomes is returned together with all of its parents, regardless of whether their outcomes match the query or not.

## Response `200`

Test executions in the given build.

- BuildTestsResponse: Test execution data for a build.
  - `summary` BuildTestsSummary, required: A summary of test execution data for a build.
    - `duration` object, required
      - `total` integer, required: The sum of the elapsed wall-clock time in milliseconds of work units with tests.
      - `serial` integer: The sum of the time in milliseconds spent if tests and containers were running sequentially. May be absent if the duration of test containers of cases is unknown (for example, the duration of forked suites is not captured in sbt).
    - `testCasesOutcomeDistribution` TestOutcomeDistribution, required: A distribution of outcomes.
      - `passed` integer, required: The number of 'Passed' outcomes.
      - `failed` integer, required: The number of 'Failed' outcomes.
      - `skipped` integer, required: The number of 'Skipped' outcomes.
      - `flaky` integer, required: The number of 'Flaky' outcomes.
      - `notSelected` integer, required: The number of 'Not Selected' outcomes.
      - `total` integer, required: The total number of outcomes.
    - `testContainersOutcomeDistribution` TestOutcomeDistribution, required: A distribution of outcomes.
      - `passed` integer, required: The number of 'Passed' outcomes.
      - `failed` integer, required: The number of 'Failed' outcomes.
      - `skipped` integer, required: The number of 'Skipped' outcomes.
      - `flaky` integer, required: The number of 'Flaky' outcomes.
      - `notSelected` integer, required: The number of 'Not Selected' outcomes.
      - `total` integer, required: The total number of outcomes.
  - `workUnits` BuildTestWorkUnit[], required: A list of test work units that were executed in the build.
    - `name` string, required: The name of the work unit.
    - `duration` BuildTestOrContainerDuration, required: Various types of test durations captured for a given test.
      - `total` integer: The elapsed wall-clock time in milliseconds when the test or container is running. May be absent if the duration of the current test container or case is unknown. For example, the duration of forked suites is not captured in sbt.
      - `own` integer: The time in milliseconds spent in the setup or cleanup of test containers. Absent for test cases.
      - `serial` integer: The sum of the time spent in milliseconds if tests and containers were running sequentially. Absent for test cases.
    - `outcome` 'passed' | 'failed' | 'skipped' | 'flaky' | 'timedOut', required
    - `tests` BuildTestOrContainer[], required: A list of test containers or test cases that were executed in this work unit.
      - `name` string, required: The name of the test or test container.
      - `duration` BuildTestOrContainerDuration, required: Various types of test durations captured for a given test.
        - `total` integer: The elapsed wall-clock time in milliseconds when the test or container is running. May be absent if the duration of the current test container or case is unknown. For example, the duration of forked suites is not captured in sbt.
        - `own` integer: The time in milliseconds spent in the setup or cleanup of test containers. Absent for test cases.
        - `serial` integer: The sum of the time spent in milliseconds if tests and containers were running sequentially. Absent for test cases.
      - `outcome` BuildTestOrContainerOutcome, required
        - `overall` 'passed' | 'failed' | 'skipped' | 'flaky' | 'notSelected', required
        - `own` 'passed' | 'failed' | 'skipped' | 'flaky' | 'notSelected'
        - `children` 'passed' | 'failed' | 'skipped' | 'flaky' | 'notSelected'
      - `executions` BuildTestOrContainerExecution[], required: A summary of individual test executions. A test can run multiple times in a build if test retries are configured.
        - `duration` BuildTestOrContainerDuration, required: Various types of test durations captured for a given test.
          - `total` integer: The elapsed wall-clock time in milliseconds when the test or container is running. May be absent if the duration of the current test container or case is unknown. For example, the duration of forked suites is not captured in sbt.
          - `own` integer: The time in milliseconds spent in the setup or cleanup of test containers. Absent for test cases.
          - `serial` integer: The sum of the time spent in milliseconds if tests and containers were running sequentially. Absent for test cases.
        - `outcome` BuildTestOrContainerOutcome, required
          - `overall` 'passed' | 'failed' | 'skipped' | 'flaky' | 'notSelected', required
          - `own` 'passed' | 'failed' | 'skipped' | 'flaky' | 'notSelected'
          - `children` 'passed' | 'failed' | 'skipped' | 'flaky' | 'notSelected'
      - `children` BuildTestOrContainer[], required: A list of child test containers or test cases that were executed in this test container.

## Other responses

- `400`: The request cannot be fulfilled due to a problem.
- `500`: The server encountered an unexpected error.

---

[API](https://skmtc.dev/develocity/apis/develocity-api.md) - [All operations](https://skmtc.dev/develocity/apis/develocity-api/llms.txt) - [OpenAPI document](https://skmtc.dev/develocity/apis/develocity-api/revisions/b49835fbf065?raw)
