This is a custom report plugin for ReportGenerator tool which produces coverage data in a json format supported by Bitbucket Server Code Coverage plugin.
- Install nuget package with a plugin
- You'll have to obtain path to the plugin's main assembly. The easiest way to do it, if you start Report Generator programmatically from C#, is to get assembly information from types in runtime:
typeof(BitbucketServerCodeCoverageGenerator).Assembly.Location
. Otherwise you have to look for your inside your local nuget cache folder. - Basic CLI invocation of ReportGenerator with the plugin should look like this:
dotnet reportgenerator -reports:TestCover1.xml -targetdir:output -reporttypes:BitbucketServer -plugins:/path/to/ReportGenerator.BitbucketServerCodeCoverage.dll
- By default, this plugin produces json file bitbucket-server-coverage.json in the output folder, that can be POSTed manually to Bitbucket Server API endpoint
https://your-server/rest/code-coverage/1.0/commits/{commit-sha}
. - This plugin can also push coverage report to the server automatically, for that you have to supply following environment variables:
BITBUCKET_SERVER_URI
- full uri to API endpoint, including sha of commit this coverage report belongs toBITBUCKET_USERNAME
- username of an account used to access APIBITBUCKET_PASSWORD
- password of an account used to access API
Feel free to ask questions, report bugs, or suggest improvements through Github issues.