anki-flex
anki-flex

Reputation: 25

Surefire report returns status as failed for skipped steps in a scenario outline

when I am aborting certain checks, it results into failing the scenario outline where in the steps are skipped. I expected the scenario outline status to be "Passed" and not "failed". The version from Pom.xml and feature file code I have attached here. Please let me know, if something is missing or wrong here.

Can you please help.

cucumber report'

<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.abc</groupId>
    <artifactId>automate</artifactId>
    <version>1</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <maven.compiler.version>3.6.0</maven.compiler.version>
        <karate.version>0.9.4</karate.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-apache</artifactId>
            <version>${karate.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-junit4</artifactId>
            <version>${karate.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>3.18.0</version>
        </dependency>

    </dependencies>
    <build>
        <testResources>
            <testResource>
                <directory>src/test/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <compilerArgument>-Werror</compilerArgument>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>

address.feature

  * def version = '3'
    * def query = {query:'<query>', country:'<country>', take:'5'}
    Given url baseUrl
    And path  '/api/address/v' + version + '/suggestions
    And params query
    And header Auth-Token = <header>
    When method get
    Then match responseStatus == <status>
##    Exiting to execute further steps in case of 400 response as results array will not be returned in the response
    * if ( responseStatus == 400 ) karate.abort()
    And match response.results == []
    And match $.length() == 1

    Examples:
      | header         | query                | country | status |
      | addressV3Token | 11122222             | AUS     | 200    |
      | addressV3Token | 14444444             | AUS| 200    |
      | addressV3Token | 100 Elizabeth avenue | USA     | 400    |

Upvotes: 1

Views: 296

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

You can read the gory details here: https://github.com/intuit/karate/issues/755

So use 0.9.5.RC5 please.

In the future you will have a configure flag to change the behavior as per what you need.

Upvotes: 1

Related Questions