# Getting failed test count from Test Engine Runs API

**URL:** <https://forum.buildkite.community/t/getting-failed-test-count-from-test-engine-runs-api/4591>\
**Category:** Test Analytics\
**Created:** [March 4, 2026, 5:09pm UTC](https://forum.buildkite.community/t/getting-failed-test-count-from-test-engine-runs-api/4591 "2026-03-04T17:09:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanyeong](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jonathanyeong](https://forum.buildkite.community/u/jonathanyeong)\
**Post date:** [March 4, 2026, 5:09pm UTC](https://forum.buildkite.community/t/getting-failed-test-count-from-test-engine-runs-api/4591/1 "2026-03-04T17:09:10Z")

</div>

Hey BuildKite Team, I’m using the Test Engine Runs API to get failed executions - [Runs API | Buildkite Documentation](https://buildkite.com/docs/apis/rest-api/test-engine/runs#get-failed-execution-data). I can see that these executions match what I see in the buildkite UI when I look at the same run ID.

However, I really want to know the failed test count. There doesn’t seem to be an API to get the failed test count. And I can’t seem to get the same number if I dedupe test execution by location or test ID.

Could you please let me know what the easiest way to fetch failed test count would be?

---

<div class="post-metadata">

**Author:** ![Ola](https://avatars.discourse-cdn.com/v4/letter/o/dbc845/32.png) [@Ola](https://forum.buildkite.community/u/Ola)\
**Post date:** [March 4, 2026, 6:50pm UTC](https://forum.buildkite.community/t/getting-failed-test-count-from-test-engine-runs-api/4591/2 "2026-03-04T18:50:22Z")

</div>

Hey @jonathanyeong 👋 ,

At the moment there isn’t a single API field that returns “failed test count” for a run. The usual approach is to compute it from executions. To match the UI-style numbers, you generally want to ignore `skipped` and count unique failing tests, which you can do as `count(distinct test_id)` across the failed executions for that run.

If you are seeing a mismatch, one common cause is the failed-executions endpoint result cap/pagination, so make sure you are retrieving all failed executions before deduping.

Can you tell me more about what you have in mind re: failed tests? Do you mean **unique tests that failed at least once** (count distinct test\_id), or **total failed executions including retries** (count failed executions)?

---

<div class="post-metadata">

**Author:** ![jonathanyeong](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jonathanyeong](https://forum.buildkite.community/u/jonathanyeong)\
**Post date:** [March 4, 2026, 6:54pm UTC](https://forum.buildkite.community/t/getting-failed-test-count-from-test-engine-runs-api/4591/3 "2026-03-04T18:54:37Z")

</div>

Thanks for the reply!

Got it. I’m counting unique failed tests and it looks like I’m getting more failed test count than what’s shown in the UI. Which is strange. I want to know the number of unique tests that failed at least once. I don’t care about retries.

Seems like the only way right now is to manipulate the failed executions result. Thanks!

---

<div class="post-metadata">

**Author:** ![Ola](https://avatars.discourse-cdn.com/v4/letter/o/dbc845/32.png) [@Ola](https://forum.buildkite.community/u/Ola)\
**Post date:** [March 4, 2026, 8:04pm UTC](https://forum.buildkite.community/t/getting-failed-test-count-from-test-engine-runs-api/4591/4 "2026-03-04T20:04:44Z")

</div>

I see. Can you reach out to [support@buildkite.com](mailto:support@buildkite.com) with more details. That way, you can share build link and some other sensitive details with us and we can help you further on this.
