ChanChow
ChanChow

Reputation: 1366

Test results are displayed with duplicate entries for failures in Jenkins

enter image description here

I am using surefire reports plugin to log the SoapUI test results in Jenkins.

<groupId>com.smartbear.soapui</groupId>
            <artifactId>soapui-pro-maven-plugin</artifactId>
            <version>5.1.2</version>
            <executions>
                <execution>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <projectFile>${basedir}/i-services-bkt.xml</projectFile>
                        <outputFolder>${basedir}/target/surefire-reports</outputFolder>
                        <junitReport>true</junitReport>
                        <junitHtmlReport>false</junitHtmlReport>
                        <exportAll>true</exportAll>
                        <printReport>true</printReport>
                        <testFailIgnore>true</testFailIgnore>
                    </configuration>
                </execution>
            </executions>

After the job is run on Jenkins, I see two entries for each failure in the report. I have post build action with publish JUnit report.

Upvotes: 5

Views: 4501

Answers (2)

ChanChow
ChanChow

Reputation: 1366

The real issue is with Jenkins. Jenkins post-build actions have a "Publish JUnit Test Results Report" action. This takes an input of the target reports path. If you use

target/surefire-reports/*-xml

the results will be reported twice. You need to pass /TEST*-xml to get results reported just once.

Upvotes: 5

dildeepak
dildeepak

Reputation: 1389

I use surefire-testng to run junit tests, but don't have any testng tests in the same run.

I extract the reports using:

**/surefire-reports/*.xml

You can configure surefire-testng to include or exclude any tests, perhaps you can exclude the junit tests by pattern, then have the junit provider run those.

surefire-reports can also be configured to collect junit and/or testng reports.

Later junit tests use annotations rather than naming conventions. testng seems to recognise this, but default behaviour of surefire-reports seems to be only collect data by naming convention.

So, You need to pass /TEST*-xml for unit and /IT*-XML for integration to get results reported just once. It will allows you to control surefire and failsafe better.

Upvotes: 0

Related Questions