Maven:针对肥皂测试案例的Junit HTML报告

时间:2016-03-09 05:58:58

标签: maven soap ant soapui

以下是我的Ant构建工具,它可以正常生成HTML报告。我想使用pom.xml而不是build.xml

 <?xml version="1.0"?>
       <project name="SoapTest" default="testreport" basedir=".">
          <target name="soapui">
       <exec dir="." executable="C:/Program Files/SmartBear/SoapUI-5.2.0/bin/testrunner.bat">
       <arg line="-j -f 'C:/soapreports' 'C:/SoapUI/APRS_SoapUI_Project.xml'"/>
       </exec>
       </target>
          <target name="testreport" depends="soapui">
          <junitreport todir="C:/soapreports">
          <fileset dir="C:/soapreports">
          <include name="TEST-*.xml"/>
          </fileset>
          <report todir="C:/soapreports/HTML" styledir="C:/Program Files/apache-ant-1.9.6/etc" format="noframes">
          </report>
          </junitreport>
       </target>   
    </project>

1 个答案:

答案 0 :(得分:1)

您可以使用以下pom.xml配置从Maven运行SoapUI项目并获取JUnit报告。使用SoapUI_Maven作为参考

<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>com.soapui.tests</groupId>
    <artifactId>SoapUI_Maven</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <properties>
        <soapui.plugin.version>
            5.1.2
        </soapui.plugin.version>
    </properties>
    <pluginRepositories>
        <pluginRepository>
            <id>smartbear-sweden-plugin-repository</id>
            <url>http://smartbearsoftware.com/repository/maven2/</url>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <groupId>com.smartbear.soapui</groupId>
                <artifactId>soapui-pro-maven-plugin</artifactId>
                <version>${soapui.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.reflections</groupId>
                        <artifactId>reflections</artifactId>
                        <version>0.9.10</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <settingsFile>${basedir}/src/config/soapui-settings.xml</settingsFile>
                    <junitReport>true</junitReport>
                    <printReport>true</printReport>
                    <coverage>${project.build.directory}/reports</coverage>
                </configuration>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <testFailIgnore>true</testFailIgnore>
                            <outputFolder>${project.build.directory}/reports</outputFolder>
                            <projectFile>"Your SoapUI project full path"</projectFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>