Issue
I have a Maven project with JUnit 4 and Cucumber tests.
I want to run one test with particular tag.
When I run command in Terminal
mvn test -Dcucumber.filter.tags="@Smoke"
or
mvn test -Dcucumber.options="--tags @Smoke"
I get errror message:
[ERROR] Unknown lifecycle phase ".options=--tags @Smoke". You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Availa ble lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-r esources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-depl oy. -> [Help 1]
Test Runner:
package step_definitions
import io.cucumber.junit.Cucumber
import io.cucumber.junit.CucumberOptions
import org.junit.runner.RunWith
@RunWith(Cucumber::class)
@CucumberOptions(
features = ["src/test/kotlin/features/"],
tags = "@Smoke",
glue = ["step_definitions"],
plugin = ["html:target/cucumber-report/cucumber.html"]
)
class TestRunner
My pom.xml:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>7.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.6.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.3.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
Where can be a problem?
Solution
Issue was only in one character " in wrong place
Correct command is:
mvn test -D"cucumber.filter.tags=@Smoke"
Answered By - JustMe
Answer Checked By - Terry (JavaFixing Volunteer)