Maven code coverage: Using maven ant run

I understand code coverage is not a feature provided through maven at this time, however, I was wondering whether there was a workaround. Currently, I have code coverage through maven using the ant run plugin along with emma.

Is there any way for teamcity to pick up the code coverage report? I imagine that it looks at the same things that are generated by emma, however I don't know how to explicitly tell teamcity to look for it. Perhaps VM arguments?

4 comments
Comment actions Permalink

actually there is a coverage plugin for maven called cobertura that works great

just run:

mvn cobertura:cobertura

howerver coverage reports does not integrate well with teamcity. or in particular, html artifacts doesnt show well if there are relative links

0
Comment actions Permalink

That sounds far easier, however, I seem to be getting a consistent nullpointer exception on report generation. I made sure to specifiy my source directory in the pom file.

Exception in thread "main" java.lang.NullPointerException
at net.sourceforge.cobertura.coveragedata.ProjectData.getSourceFiles(Pro
jectData.java:105)
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateSourceFil
eList(HTMLReport.java:167)
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateSourceFil
eLists(HTMLReport.java:150)
at net.sourceforge.cobertura.reporting.html.HTMLReport.]]>(HTMLReport
.java:79)
at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:100
)
at net.sourceforge.cobertura.reporting.Main.main(Main.java:161)

Message was edited by:
Justin DeWind

0
Comment actions Permalink

bin zhu wrote:

actually there is a coverage plugin for maven called cobertura that works great

just run:

mvn cobertura:cobertura

howerver coverage reports does not integrate well with teamcity. or in particular, html artifacts doesnt show well if there are relative links


That's known problem, you may vote/monitor http://www.jetbrains.net/jira/browse/TW-462 issue.


Kind regards,
KIR


--
Kirill Maximov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Justin DeWind wrote:

I understand code coverage is not a feature provided through maven at this time, however, I was wondering whether there was a workaround. Currently, I have code coverage through maven using the ant run plugin along with emma.

Is there any way for teamcity to pick up the code coverage report? I imagine that it looks at the same things that are generated by emma, however I don't know how to explicitly tell teamcity to look for it. Perhaps VM arguments?


If your emma run generates coverage.ec and coverage.em files in the project home directory,
you can add them to artifacts paths of the build configuration (coverage.em,coverage.ec) and you
should be able to get coverage reports in IDEA (but not on Web).

Kind regards,
KIR


--
Kirill Maximov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.