1
votes

My requirement is to run multiple SOAPUI test cases via maven , automate it's build using jenkins and generate a report of the test results. I have successfully done except the last part.

Now i want to generate a html report of results of all the test cases. I used maven-surefire-report-plugin to do so.

I have followed this article http://maven.apache.org/surefire/maven-surefire-report-plugin/usage.html The test case is successful and report is generated successfully but there are no records in the report.

enter image description here

Am i missing something here? Is there any configuration parameter to set the source path for generating reports or something?

surefire report is generated in ${project.build.directory}/site folder. Output files of the SOAPUI test case is generated at ${project.build.directory}/reports folder.

This is the pom.xml i have written

<?xml version="1.0" encoding="UTF-8"?> <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>soapTest</groupId>
<artifactId>soapTest</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>

<pluginRepositories>
    <pluginRepository>
        <id>SmartBearPluginRepository</id>
        <url>http://www.soapui.org/repository/maven2/</url>
    </pluginRepository>
</pluginRepositories>

<build>
    <plugins>
        <plugin>
            <groupId>com.smartbear.soapui</groupId>
            <artifactId>soapui-maven-plugin</artifactId>
            <version>5.1.2</version>
            <configuration>
                <projectFile>soapui-project.xml</projectFile>
                <outputFolder>${project.build.directory}/test-classes</outputFolder>
                <junitReport>true</junitReport>
                <exportAll>true</exportAll>
                <printReport>true</printReport>
                <testSuite>Authenticate</testSuite>
            </configuration>

            <executions>
                <execution>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.7.2</version>
        </plugin>

    </plugins>
</reporting>

2
how did you enable surefire report in jenkins? i have add surefire plugin but the report still use basic junit report not surefire reportJ. Doem

2 Answers

3
votes

First line of the Maven Surefire Report Plugin Introduction says:

The Surefire Report Plugin parses the generated TEST-*.xml files under ${basedir}/target/surefire-reports ...

So if you change your soapui-maven-plugin to:

<outputFolder>${basedir}/target/surefire-reports</outputFolder>

That should work.

There are also additional instructions how to change the default location for the maven-surefire-report-plugin.

0
votes

Sample pom.xml where reports are also being created with mvn site command.

<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.smartbear.samples</groupId>
    <artifactId>soapui-maven-plugin</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>Maven 2 SoapUI Sample</name>
    <url>http://maven.apache.org</url>
<pluginRepositories>
    <pluginRepository>
        <id>smartbear-sweden-plugin-repository</id>
        <url>http://www.soapui.org/repository/maven2/</url>
    </pluginRepository>
</pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <groupId>com.smartbear.soapui</groupId>
                <artifactId>soapui-maven-plugin</artifactId>
                <version>5.3.0</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <projectFile>globalweather-soapui-project.xml</projectFile>
                            <junitReport>true</junitReport>
                            <outputFolder>${basedir}/target/surefire-reports</outputFolder>
                            <printReport>true</printReport>
                            <exportAll>true</exportAll>
                            <globalProperties>
                                <value>ENV=DEV</value>
                            </globalProperties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
<reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.20.1</version>
        <configuration>
          <outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </reporting>
</project>