2

我在使用 cobertura 创建报告时遇到问题。我还使用了surefire 插件,该插件配置为<skip>true</skip>但在执行元素内的集成测试阶段设置为<skip>false</skip>.

我将 cobertura 的执行配置为与<goal>cobertura</goal>. 它适用于单个模块,但是当我在父 pom 上运行它时,它只会创建0%的报告覆盖率。我也设置了<aggregate>true</aggregate>.

老实说,我不确定如何正确配置带有surefire的cobertura,所以我在这里寻求帮助。我认为这可能是“错误的阶段”问题或在surefire插件中设置的arg或其他东西。

我正在使用 cobertura maven 插件 2.5.1、maven 3.0.4、surefire 2.14 和 jdk6。

小控制台输出(似乎稍后会运行测试):

[INFO] ------------------------------------------------------------------------
[INFO] Building BasicService 12.1.24-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ BasicService ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ BasicService ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ BasicService ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ BasicService ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.14:test (default-test) @ BasicService ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ BasicService ---
[INFO] Building jar: D:\workspaces\kepler-R\trunk\commonLogic\ntas\BusinessServices\BasicService\target\BasicService-12.1.24-SNAPSHOT.j
[INFO]
[INFO] >>> cobertura-maven-plugin:2.5.1:cobertura (default) @ BasicService >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ BasicService ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ BasicService ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- cobertura-maven-plugin:2.5.1:instrument (default) @ BasicService ---
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 9 classes.
Instrumenting 9 files to D:\workspaces\kepler-R\trunk\commonLogic\ntas\BusinessServices\BasicService\target\generated-classes\cobertura
Cobertura: Saved information on 9 classes.
Instrument time: 328ms

[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ BasicService ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ BasicService ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.14:test (default-test) @ BasicService ---
[INFO] Tests are skipped.
[INFO]
[INFO] <<< cobertura-maven-plugin:2.5.1:cobertura (default) @ BasicService <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.5.1:cobertura (default) @ BasicService ---
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 9 classes.
Report time: 594ms

[INFO] Cobertura Report generation was successful.
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 9 classes.
Report time: 813ms

[INFO] Cobertura Report generation was successful.
[INFO]
[INFO] --- maven-surefire-plugin:2.14:test (default) @ BasicService ---
[INFO] Surefire report directory: D:\workspaces\kepler-R\trunk\commonLogic\ntas\BusinessServices\BasicService\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.kogerusa.services.BasicServiceTest
08:48:55,371  INFO TransactionManagerFactory:148 - Standalone Bitronix transaction manager has been set
08:48:55,386  INFO TransactionManagerFactory:109 - Hibernate session factory bean has been configured for Bitronix JTA
...
4

0 回答 0