質問

I'm working on a .NET project that uses Jenkins as the CI server. The server is working as it's supposed to but now I'm trying to make it emit alerts in case of low code coverage.

The approach that I'm trying is to use Sonar to execute NUnit and OpenCover, but I need to link the code coverage metrics from Sonar back to Jenkins and that's where the problem resides.

AFAIK the report generated from OpenCover (coverage-report.xml) as is, is not recognized from Jenkins so what I'm trying to do is to make them talk by a xsl file that transforms the (coverage-report.xml) to a (emma-report.xml) that Jenkins has plugins that understands.

Although I don't know it that is the best approach. Better approaches are more than welcome ;) I'm facing a problem to get the block coverage metrics from OpenCover (Emma needs this metric).

I've managed to transform all other metrics needed class, %, method, % and line, % from OpenCover to Emma, but I'm not sure if is possible to get the block, % from the report.

Can anyone tell me if it is possible or if there is a better approach to achieve what I'm trying to do (that is, make Jenkins emit build alerts when code coverage is bellow a certain percentage)?

Thanks in advance! :)

役に立ちましたか?

解決

If you are running OpenCover from the sonar gallio plugin (from the sonar C# ecosystem), a simple solution to get alerts on low code coverage could be the sonar build breaker plugin. You would get a broken build when coverage get below an alert threshold. This solution does not allow to get graph or trends in jenkins, but again if you use sonar, you have everything in the sonar dashboards. Hope it helps

他のヒント

It looks like there is now a tool to convert OpenCover reports to Covertura XML https://github.com/danielpalme/OpenCoverToCoberturaConverter/tree/master/OpenCoverToCoberturaConverter

The thread discussing this.

http://reportgenerator.codeplex.com/discussions/398788

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top