由于缺少执行数据文件而跳过JaCoCo执行

时间:2015-09-02 12:55:42

标签: jacoco

做的一切正确,但仍然丢失数据文件错误              $ {} project.build.directory /coverage-reports/jacoco-it.exec     

<build>
    <finalName>maven-integration-testing</finalName>

    <plugins>
        <!-- Used to add source directories to our build. -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <!-- States that the plugin's add-test-source goal is executed at generate-test-sources 
                    phase. -->
                <execution>
                    <id>add-integration-test-sources</id>
                    <phase>generate-test-sources</phase>
                    <goals>
                        <goal>add-test-source</goal>
                    </goals>
                    <configuration>
                        <!-- Configures the source directory of integration tests. -->
                        <sources>
                            <source>src/integration-test/java</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.5.201505241946</version>
            <executions>


                <execution>
                    <id>pre-integration-test</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                    <configuration>
                        <!-- Sets the path to the file which contains the execution data. -->
                        <destFile>${jacoco.it.execution.data.file}</destFile>
                        <!-- Sets the name of the property containing the settings for JaCoCo 
                            runtime agent. -->
                        <propertyName>failsafeArgLine</propertyName>
                    </configuration>
                </execution>

                <execution>
                    <id>post-integration-test</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                    <configuration>
                        <!-- Sets the path to the file which contains the execution data. -->
                        <dataFile>${jacoco.it.execution.data.file}</dataFile>
                        <!-- Sets the output directory for the code coverage report. -->
                        <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <!-- Used for integration tests -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.15</version>
            <executions>
                <!-- Ensures that both integration-test and verify goals of the Failsafe 
                    Maven plugin are executed. -->
                <execution>
                    <id>integration-tests</id>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                    <configuration>
                        <!-- Sets the VM argument line used when integration tests are run. -->
                        <!-- <argLine>${failsafeArgLine}</argLine> -->
                        <argLine>${argLine} -Xmx4096m -XX:MaxPermSize=512M ${failsafeArgLine}</argLine>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

prepare-agent:它没有创建数据文件,我有spring mvc应用程序,它有服务,我已经为此编写了测试用例并尝试获取此代码的覆盖率

0 个答案:

没有答案