Navraj Joshi
Navraj Joshi

Reputation: 77

command line could not overridden cucumber options

my pom.xml is below and the automation is working fine. but when the automation is run using command line, always use runner configuration and does not override the runner file. I used command

mvn clean test -Dcucumber.options="src/test/resources/features/myfeature.feature", it always run all test scenario instead of containing scenarios in myfeature file 

Upvotes: 0

Views: 639

Answers (2)

M.P. Korstanje
M.P. Korstanje

Reputation: 12029

The cucumber.options property has been removed. To select a single feature file you can use cucumber.features.

For other properties see:

https://github.com/cucumber/cucumber-jvm/tree/main/core#properties-environment-variables-system-options

Upvotes: 1

Navraj Joshi
Navraj Joshi

Reputation: 77

pom.xml is

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>OpenText</groupId>
    <artifactId>TestApp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>TestApp</name>
    <description>TestApp Web Automation</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <selenium.version>4.1.1</selenium.version>
        <junit.version>4.13.2</junit.version>
        <cucumber.version>7.3.4</cucumber.version>
        <maven.compiler.version>3.8.1</maven.compiler.version>
        <maven.surefire.version>2.22.2</maven.surefire.version>
        <webdriver.manager.version>5.0.2</webdriver.manager.version>
        <ng.webdriver.version>1.1.6</ng.webdriver.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
            <!--<scope>test</scope> -->
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <!--<scope>test</scope> -->
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>${cucumber.version}</version>
        </dependency>


        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <!--<scope>test</scope> -->
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
        </dependency>


        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version>
        </dependency>

        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>${webdriver.manager.version}</version>
        </dependency>
        <dependency>
            <groupId>com.paulhammant</groupId>
            <artifactId>ngwebdriver</artifactId>
            <version>${ng.webdriver.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.30</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.version}</version>
            </plugin>

        </plugins>
    </build>

</project>

Upvotes: 0

Related Questions