问题
We have several multi-module projects which I want to run emma against, but I don't want the tests to be run twice, because this results in misleading statistics on the Hudson project home page as unit tests are counted twice.
For a single module project, we can ommit the install goal and just use clean emma:emma to run the tests once, is there any way we can test only using emma instrumented byte code and then build & install the project artifacts without running the tests a second time? Using -Dmaven.tests.skip=true causes emma to fail.
For a full release (i.e. mvn release:perform) the tests should be run un-instrumented.
回答1:
You may consider the following article to answer "how to calculate.." code coverage. The coverage would then not be visible in Hudson but in sonar. This is not exactly what you are looking for, but sonar is worth an evaluation. (Installation is really a breeze)
I would use a profile to activate the test configuration with emma, and that by default the project is built and installed without running tests.
来源:https://stackoverflow.com/questions/3459988/how-to-calculate-code-coverage-in-hudson-using-emma-for-a-multi-module-maven-pro