Feature #44345
openUse SimpleCov's built-in HTML formatter instead of Redmine's own formatter
Description
Redmine uses SimpleCov to measure test coverage. Running bin/rails test:coverage runs the test suite with coverage enabled and generates an HTML report in the coverage directory.
The report is currently generated by Redmine's own formatter, consisting of source:trunk/test/coverage/html_formatter.rb@24890 and two ERB templates (source:trunk/test/coverage/views@24890). I propose replacing it with SimpleCov's built-in HTML formatter.
Before (Redmine's custom formatter):
After (SimpleCov's built-in formatter):
- We no longer have to maintain the custom formatter.
- The report can be filtered by file name and coverage rate, and sorted by any column. The current report is a single flat table.
- The SimpleCov CLI becomes usable.
bundle exec simplecov open,report, anduncoveredreadcoverage/coverage.json, which the custom formatter does not generate. - Files are grouped into tabs (Controllers, Models, Helpers, Libraries, ...) instead of being listed in a single table.
- Branch and method coverage can be displayed if enabled later. The current templates support only line coverage.
The Redmine-specific links in the report header are dropped: the revision used to generate the report and the Continuous_integration wiki page. These were intended for reports published at https://www.redmine.org/builds/, which is no longer in operation.

Files
Updated by Marius BĂLTEANU 19 days ago
- Status changed from New to Resolved
- Assignee set to Marius BĂLTEANU
- Target version changed from Candidate for next major release to 7.1.0
- Resolution set to Fixed
Nice!
I've committed the changes, thanks!
Updated by Marius BĂLTEANU 19 days ago
- File 0001-Add-SimpleCov-coverage-to-Github-Actions-test-workfl.patch added
- Status changed from Resolved to Closed
Go MAEDA, what do you think if we run one test suite from the matrix with coverage enabled? Another option is to have a nightly run.
Updated by Marius BĂLTEANU 19 days ago
- File deleted (
0001-Add-SimpleCov-coverage-to-Github-Actions-test-workfl.patch)
Updated by Go MAEDA 19 days ago
Marius BĂLTEANU wrote in #note-2:
Go MAEDA, what do you think if we run one test suite from the matrix with coverage enabled? Another option is to have a nightly run.
Just to make sure I understand correctly: to view the coverage report, we would need to open the Actions tab, download the artifact as a ZIP file, and extract it locally. Is that right?
If so, I probably wouldn't look at it very often, simply because it takes several steps to get there. That said, I don't object to adding it at all.
Updated by Marius BĂLTEANU 18 days ago
Because I do not run the whole test suite on my local environment very often, my ultimate goal is to set up a coverage badge displaying the percentage value, as well as a visual breakdown of coverage trends over time.
Based on a quick research, there are two main paths for trend tracking:- SaaS Integration (e.g., Codecov / Coveralls): Hooks into GitHub Actions to store test history automatically and generate both the badge and trend graphs out of the box.
- Self-hosted: Store historical
.last_run.jsonexecution data somewhere and then, render a custom dynamic badge via Shields.io. I'm not sure how to deal with trend history.