Skip to main content

Dynamically generated test stats badges on your Readme's

Since badges provide users with a fast way to capture repository metrics, they increase the readability of the repositories. You can effectively use Foresight's test badges on your repository to attract and keep contributors.

Foresight offers various badges for your tests. The more you show that your software is tested well, the more trust you earn from your community. You can easily create badges after integrating your repository with Foresight

How to generate badges?โ€‹

1) Hover on the repository card and click on the "..." icon on the top right

Repo cards for badge

2) Select the badge type

3) Copy the Markdown and paste it to your Readme file

Badges

Badge Typesโ€‹

1) Tests Badge

Tests badge

Tests badge displays the latest test run results of your build. You can easily show the number of successful, failed, and skipped tests of your latest run.

2) Test Utilization Score Badge

Test Utilization Score Badge

Foresight calculates how your test code is performing. Foresight gathers the pure test execution duration, by removing the total beforeEach, afterEach, beforeAll, and afterAll duration from the total test run duration. With the Test Utilization Score badge, you can show how you wrote tests performing efficiently.

3) Successful Tests Badge

Successful Tests Badge

Successful Tests badge displays the ratio of successful tests of the latest test run

Configuring your branch and workflowโ€‹

If you add the branch and the workflow query at the end of your badge url, you'll get the specific information on your badges.

&branch=<your-branch-info>&workflowName=<your-workflow-name>

Example usage

https://api-public.service.runforesight.com/api/v1/badge/success?repoId=a2b01877-ab45-49a9-8686-3de3b1df682f&branch=main&workflowName=Keycloak%20CI

image