Jacoco Code coverage with Robotframework Maven pom.xml example

转自:https://github.com/DeziderMesko/RobotframeworkCodeCoverage/blob/master/pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>dme.example</groupId>
    <artifactId>robot.coverage</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Robotframework Coverage</name>
    <properties>
        <skipRobotTests>false</skipRobotTests>
        <skipUnitTests>false</skipUnitTests>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.robotframework</groupId>
                <artifactId>robotframework-maven-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>acceptance-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <skip>${skipRobotTests}</skip>
                            <testCasesDirectory>${project.basedir}/src/test/robotframework/</testCasesDirectory>
                            <outputDirectory>${project.basedir}/target/robotframework-reports/</outputDirectory>
                            <externalRunner>
                                <excludeDependencies>false</excludeDependencies>
                                <jvmArgs>
                                    <jvmArg>${argLine}</jvmArg>
                                </jvmArgs>
                            </externalRunner>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.6.4.201312101107</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <executions>
                    <execution>
                        <id>default-test</id>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unit-tests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>${skipUnitTests}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
原文地址:https://www.cnblogs.com/z1500592/p/6676661.html