Eli
Eli

Reputation: 39009

Publish Test Coverage Report Through Jenkins to Slack

I'm calculating code coverage on every build done in Jenkins and producing a coverage XML report. That's recorded really nicely inside of Jenkins with Cobertura, but what I'd really like is to be able to somehow get at the total branch coverage number so I can automatically publish to a medium the rest of my team can easily consume (i.e. Slack).

As a bonus, getting the difference in coverage from the last run would be even better. I don't see any environment variables that hold this, and haven't found anything detailing a simple way to do this in Cobertura docs. I know I can hack some code together to do this myself, but if there's a simple way I'm missing or something someone else has already built, I'd much rather do that.

Upvotes: 2

Views: 2086

Answers (1)

Christopher Orr
Christopher Orr

Reputation: 111625

I believe you'll have to do this yourself.

The existing Slack plugin just sends build start/success/failure notifications etc.

The Cobertura plugin unfortunately doesn't seem to be built on top of the static code analysis plugin, so there probably isn't much in the way of graphs, difference reports and all that.

You could try adding /api/json to the end of a Cobertura report URL for a Jenkins build — most endpoints reveal some information in this way. If there's some useful information, that could be a basis for whatever you want to hack together.

Upvotes: 1

Related Questions