Surefire report generating duplicate result in the report

本小妞迷上赌 提交于 2019-12-24 00:27:57

问题


I am following the SO link of MAVEN with ANT Task for SOAPUI automation run with jenkins.

It works fine and executes. But Surefire html report generating same testSuite, testCases twice.

ANT JUnit Report generates right report

Below is my pom.xml file -

<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.amadeus.developers</groupId>
<artifactId>pad-apis</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>PAD API (Self-Services APIs)</name>
<url>http://rndwww.nce.amadeus.net/git/scm/ad/pad-api-regression.git</url>
<description>Automated api test for Amadeus Self-Services APIs</description>

<pluginRepositories>
    <pluginRepository>
        <id>smartbear-sweden-plugin-repository</id>
        <url>http://www.soapui.org/repository/maven2/</url>
    </pluginRepository>
</pluginRepositories>

<dependencies>
    <dependency>
        <groupId>org.reflections</groupId>
        <artifactId>reflections</artifactId>
        <version>0.9.9-RC1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.10-FINAL</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.smartbear.soapui</groupId>
            <artifactId>soapui-maven-plugin</artifactId> 
            <version>5.3.0</version>
            <configuration>                 
                <projectFile>${project.basedir}/src/test/PAD-API-Regression-soapui-project.xml</projectFile>                    
                <outputFolder>${project.basedir}/target/surefire-reports</outputFolder>                 
                <junitReport>true</junitReport>
                <exportAll>true</exportAll>
                <printReport>true</printReport>
                <testFailIgnore>true</testFailIgnore>
            </configuration>
            <executions>
                <execution>
                    <id>test-report</id>                
                    <phase>test</phase>
                    <goals>             
                        <goal>test</goal>                           
                    </goals>
                </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>
        <plugin>
            <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
            <artifactId>maven-antrun-extended-plugin</artifactId>
            <executions>
                <execution>
                    <id>test-report</id>                
                    <phase>test</phase>
                    <goals>             
                        <goal>run</goal>                            
                    </goals>
                    <configuration>
                        <tasks>
                            <junitreport todir="target/surefire-reports">
                                <fileset dir="target/surefire-reports">
                                    <include name="**/*.xml"/>
                                </fileset>
                                <report format="noframes" todir="target/site"/>
                            </junitreport>
                        </tasks>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.apache.ant</groupId>
                    <artifactId>ant-junit</artifactId>
                    <version>1.8.0</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.ant</groupId>
                    <artifactId>ant-trax</artifactId>
                    <version>1.8.0</version>
                </dependency>
            </dependencies>     
        </plugin>
    </plugins>
</build>
<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <reportsDirectories>
                    <reportsDirectories>${project.basedir}/target/surefire-reports</reportsDirectories>
                </reportsDirectories>
                <skipTests>true</skipTests>
                <redirectTestOutputToFile>true</redirectTestOutputToFile>
                <linkXRef>false</linkXRef>
                <outputName>report</outputName>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.github.damage-control.report</groupId>
            <artifactId>damage-control-maven-plugin</artifactId>
            <version>1.2</version>
        </plugin>
    </plugins>
</reporting>

I tried to modify some configuration like in pom.xml file

in surefire plugin

<executions>
      <execution>
        <id>attach-sources</id>
        <goals>
          <goal>jar-no-fork</goal>
        </goals>
      </execution>
</executions>

in ANT task config -

<phase>generate-sources</phase>

Nothing is working.

In the pom.xml file, I have damage-control plugin also to generate report - But damage-control plugin is not also generating proper report -

For damage-control report, I understand the generated .xml/.txt file is not the right format like Selenium Surefire plugin generates. That might be reason not to generate proper damage-control report. As this is SOAPUI project - is there any work around to generate damage-control report from SOAPUI project -

Below are the logs from SOAPUI project and Selenium Project -

SOAPUI Log-

Status: OK
Time Taken: 9
Size: 3858
Timestamp: Fri Jun 09 09:14:06 CEST 2017
TestStep: API_airport-lists-by-city/country_UtilitiesFamily

----------------- Messages ------------------------------

----------------- Properties ------------------------------
StatusCode: 200
Method: GET
HTTP Version: HTTP/1.1
Endpoint: amadeus.net:8888
 URL: http://..../api/v0/apis/7

---------------- Request ---------------------------
Host: [amadeus.net:8888]
Accept-Encoding: [gzip,deflate]
User-Agent: [Apache-HttpClient/4.1.1 (java 1.5)]
Connection: [Keep-Alive]

GET http://....../api/v0/apis/7 
HTTP/1.1
Accept-Encoding: gzip,deflate
Host: amadeus.net:8888
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

Surefire Report Log -

-------------------------------------------------------------------------------
Test set: com.amadeus.developers.pad.amp.catalogue.Catalogue_TryIt_002_SoapSpec

 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 22.517 sec - in com.amadeus.developers.pad.amp.catalogue.Catalogue_TryIt_002_SoapSpec

Both the format are different, and I guess that's the reason damamge-control plugin is not able to generate proper report.

However if there is some solution of surefire-report duplication and work around of damage-control plugin for soapui , it would be helpful.

来源:https://stackoverflow.com/questions/44453012/surefire-report-generating-duplicate-result-in-the-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!