【问题标题】:Run Cobertura on xtext-project together with Maven and Tycho-surefire与 Maven 和 Tycho-surefire 一起在 xtext-project 上运行 Cobertura
【发布时间】:2014-04-27 19:03:05
【问题描述】:

我有一个多模块项目,其中一个测试模块可以测试其他三个模块。我已经设置了 cobertura 仪器,使用此处描述的 maven antrun-plugin 进行合并和报告:cobertura on maven multi module project 但我不会用仪器类覆盖普通类,而是将它们存储在每个模块的仪器类文件夹中。在集成测试后阶段,我合并 cobertura.ser 文件并在最后执行的测试模块的 pom.xml 中生成报告。

如何配置 tycho-surefire 以使用检测类而不是普通类?否则我总是得到 0% 的覆盖率......

我没有找到简单的解决方案,cobertura:aggregate 目标不起作用

【问题讨论】:

  • 指定我的问题:我想将 target/instrumented-classes 文件夹中的检测类添加到 tycho-surefire 类路径中,例如运行测试部分中的 link 与 Ant <classpath location="${instrumented.dir}" /> <classpath location="${classes.dir}" />
  • 我也有同样的问题。如果您找到解决方案,请分享它

标签: maven xtext cobertura multi-module tycho-surefire-plugin


【解决方案1】:

我改用 Jacoco,这对我有用。

<!-- This profile is used to gather code coverage with Jacoco -->
    <profile>
        <id>codeCoverage</id>
        <properties>
            <!-- Properties to enable jacoco code coverage analysis -->
            <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
            <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
            <sonar.jacoco.reportPath>/path/to/jacoco.exec</sonar.jacoco.reportPath>
        </properties>

        <build>
            <plugins>
                <!-- Enabling use of jacoco -->
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-plugin-version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <!-- Where to put jacoco coverage report -->
                                <destFile>${sonar.jacoco.reportPath}</destFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

【讨论】:

    猜你喜欢
    • 2012-03-08
    • 2012-06-16
    • 2021-01-18
    • 1970-01-01
    • 2016-09-17
    • 2010-10-18
    • 2021-05-16
    • 1970-01-01
    • 2015-12-19
    相关资源
    最近更新 更多