Skip to content
Join Now Login

README Badges

Showcase your test health with dynamic badges powered by shields.io. Badges update automatically with each test run.

Gaffer provides three badge types:

BadgeExampleDescription
TestsTests badgeShows your test pass rate percentage
CoverageCoverage badgeShows your code coverage percentage
FlakyFlaky badgeShows the count of flaky tests detected

Badges use the shields.io endpoint badge format. Gaffer provides public JSON endpoints that shields.io fetches to render your badges dynamically.

BadgeEndpoint
Tests/api/badges/:projectId/health.json
Coverage/api/badges/:projectId/coverage.json
Flaky/api/badges/:projectId/flaky.json

The easiest way to get badge embed code is from your project settings:

  1. Go to your project in the Gaffer dashboard
  2. Navigate to SettingsBadges
  3. Choose your preferred badge style
  4. Copy the Markdown or HTML code
  5. Paste into your README

You can also construct badge URLs manually. Replace YOUR_PROJECT_ID with your Gaffer project ID:

[![Tests](https://img.shields.io/endpoint?url=https://app.gaffer.sh/api/badges/YOUR_PROJECT_ID/health.json)](https://app.gaffer.sh/projects/YOUR_PROJECT_ID)
[![Coverage](https://img.shields.io/endpoint?url=https://app.gaffer.sh/api/badges/YOUR_PROJECT_ID/coverage.json)](https://app.gaffer.sh/projects/YOUR_PROJECT_ID)
[![Flaky](https://img.shields.io/endpoint?url=https://app.gaffer.sh/api/badges/YOUR_PROJECT_ID/flaky.json)](https://app.gaffer.sh/projects/YOUR_PROJECT_ID)
<a href="https://app.gaffer.sh/projects/YOUR_PROJECT_ID">
<img src="https://img.shields.io/endpoint?url=https://app.gaffer.sh/api/badges/YOUR_PROJECT_ID/health.json" alt="Tests">
</a>

Shields.io supports multiple badge styles. Add the style parameter to customize:

StyleExampleParameter
Flat (default)Flat stylestyle=flat
Flat SquareFlat square stylestyle=flat-square
PlasticPlastic stylestyle=plastic
For the BadgeFor the badge stylestyle=for-the-badge

Badge colors automatically reflect your project’s health using a 5-level scale:

Pass RateColor
≥90%brightgreen
≥75%green
≥50%yellow
≥25%orange
<25%red
CoverageColor
≥80%brightgreen
≥60%green
≥40%yellow
≥20%orange
<20%red
Flaky TestsColor
0brightgreen
1-3yellow
4-10orange
>10red

When no data is available (e.g., no test runs yet), badges display “N/A” with a neutral gray color.

Badge data is cached for 5 minutes to ensure fast loading times and reduce API load. After uploading new test results, badges will update within 5 minutes.

Here’s how badges might look in a README:

my-awesome-project

Tests Coverage Flaky

A well-tested project with great coverage and no flaky tests!