Amir Malik
Amir Malik

Reputation: 23

Jenkins stop build on unit test first failure

I have a maven job running in jenkins. This maven project runs soap project which contains testcases. The pom.xml of this maven project is configured as

<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>src.main.resources</groupId>
<artifactId>soapui-maven2-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.github.redfish4ktc.soapui</groupId>
            <artifactId>maven-soapui-extension-plugin</artifactId>
            <version>4.6.4.2</version>
            <configuration>
                <runnerType>OSS</runnerType>
                <projectFile>Dev-Offline-soapui-project.xml</projectFile>
                <junitReport>true</junitReport>
                <outputFolder>${project.build.directory}/tatunka-reports</outputFolder>
                <testSuite>SmokeTestSuite</testSuite>
                <testSuiteProperties>
                    <properties>
                        <property>serviceEndpoint=${serviceEndpoint}</property>
                    </properties>
                </testSuiteProperties>
                <skipAfterFailureCount>1</skipAfterFailureCount> 
            </configuration>
            <executions>
                <execution>
                <configuration>
                <junitReport>true</junitReport>
                </configuration>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>com.smartbear.soapui</groupId>
                    <artifactId>soapui-maven-plugin</artifactId>
                    <version>5.1.0</version>
                </dependency>
            </dependencies>
        </plugin>   
    </plugins>
</build>

And in jenkins goal and options is given as

test -DserviceEndpoint=http://localhost:8080/DAMService/solutionid -DskipTests=true

What I want is the jenkins to stop running other testcases if any testcase fails. For example, i have 9 testcases and 4th testcase fails then remaining 5 testcases should not be executed.

I tried to give

<skipAfterFailureCount>1</skipAfterFailureCount> 

but no result. And even tried giving -DskipTests=true option as build arguement. And also tried with goal verify. But could not achieve to stop the running of testcases. Please, let me know if any more information is needed.

Upvotes: 2

Views: 2262

Answers (1)

Ramu
Ramu

Reputation: 161

Add <testFailureIgnore>true</testFailureIgnore>under plugin configuration and try

Upvotes: 1

Related Questions