reports keyword to display both test and coverage reports directly in a Merge Request (MR). Instead of merely storing artifacts, you’ll provide reviewers with immediate feedback—failing tests, coverage metrics, and line-by-line highlights.
Configuring JUnit and Coverage Reports
Add JUnit and Cobertura reporting to your.gitlab-ci.yml:
Setting
expire_in: 3 days keeps recent results accessible without long-term storage costs.Editing Multiple Files in the Web IDE
- Open the project in GitLab’s Web IDE.
- Switch to your feature branch.
- Remove any placeholder jobs.
- Copy in the CI definitions above.

Introducing a Test Failure
Inapp-test.js, force a test to fail by expecting "Planet-Mercury" instead of "Mercury":
Creating a Coverage Gap
Introduce an untested line inapp.js:
Running the Pipeline
Commit and push your changes. A new pipeline will start automatically:
Align your coverage thresholds with team guidelines to avoid unexpected failures.
Other Report Types
GitLab supports multiple report formats:| Report Type | Format | CI Keyword | Example Path |
|---|---|---|---|
| JUnit | JUnit XML | reports:junit | test-results.xml |
| Coverage | Cobertura XML | reports:coverage_report | coverage/cobertura-coverage.xml |
| RSpec JUnit | RspecJunitFormatter XML | reports:junit | rspec.xml |


Viewing Test Failures in the Job Log
After the pipeline runs, review the job log for failures and coverage warnings:
Exploring Reports in a Merge Request
- Push your feature branch and open an MR titled Exploring GitLab CI/CD:

-
The MR pipeline runs via these workflow rules:
-
Check the MR sidebar for:
- A test summary (e.g., 1/11 failed)
- Coverage percentage
- Detailed assertion errors

- In the Changes tab, you’ll see diffs highlighting:
- Modified test expectations
- New console logs in
app.js - Coverage gaps (orange) and covered lines (green)
Conclusion
By using GitLab CI’sreports keyword, you surface test results and coverage details directly within Merge Requests. This streamlines code reviews, enabling teams to catch failures and coverage gaps before merging.
Links and References
- GitLab CI/CD Reports Documentation
- JUnit Format Specification
- Cobertura Coverage Format
- GitLab Web IDE
- Chai HTTP