问题
I have a multi module maven project in one git repository and my integration test cases on another git repository. The output of multi module maven project is three jars for three modules. Now is there a way via command line (so that we can run this through jenkins) to find code coverage for integration tests that are in another repository. The JAR when ran through java -jar <<jarname>>
it starts a jetty server with the application.
回答1:
You can execute your jar with JaCoCo agent to gather coverage data - http://www.jacoco.org/jacoco/trunk/doc/agent.html
And write a small Ant-script to combine classes, sources and coverage data for generation of report - http://www.jacoco.org/jacoco/trunk/doc/ant.html
Note that generation of report requires exact same classes that were used during execution of tests - http://www.jacoco.org/jacoco/trunk/doc/classids.html
来源:https://stackoverflow.com/questions/42088458/find-code-coverage-for-multi-module-maven-project