Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 1.7 KB

README.md

File metadata and controls

29 lines (17 loc) · 1.7 KB

Example repo to demonstrate Code Coverage Gates with CodeScene

This repository contains one simple Java module with unit tests. The purpose of the repo is to illustrate how CodeScene's code coverage gates work, as well as give concrete examples of what the gating looks like for various scenarios. (e.g. lack of coverage in new code, updating non-executable lines of code, etc.).

As such, this repository is part of the CodeScene product documentation.

That documentation explains how to enable code coverage gates on your own repositories.

Examples on how the Code Coverage Gates behave

  • Scenario 1: Code is modified without adding the minimum level of tests. The gates fail. (Example PR).
  • Scenario 2: A developer adds tests, making the gates pass. (Example PR).

Details for maintainers

Generate build coverage - JaCoCo

mvn clean install

You'll then find the generated XML coverage report in target/site/jacoco/jacoco.xml.

github workflow

There is a playground workflow .github/workflows/test-run.yml which demonstrates how to invoke the coverage tools.

The reusable check-coverage action takes a numeric project-id, passes it to cs-coverage check --project-id, and accepts an optional onprem-url for CodeScene On-prem. For Cloud projects, the action uses the CLI's default API URL.