Reputation: 1
I can run Serentiy Test using mvn clean verify command which uses the tags mentioned in cucumber test runner file. I want to run the test from command line using specified tags. i.e. mvn verify -Dcucumber.options = "--tags=@UI" Throws error - Unable to parse command line options: Unrecognized option: --tags=@UI
POM file :
<modelVersion>4.0.0</modelVersion>
<groupId>XX.XX.XXX</groupId>
<artifactId>ABC_DEMO</artifactId>
<version>1.0-SNAPSHOT</version>
<name>TASK</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<serenity.version>4.0.29</serenity.version>
<serenity.maven.version>4.0.18</serenity.maven.version>
<junit.version>4.13.2</junit.version>
<rest.assured.version>5.3.2</rest.assured.version>
<json.version>20231013</json.version>
<maven.surefire.plugin.version>3.1.2</maven.surefire.plugin.version>
<maven.failsafe.plugin.version>3.1.2</maven.failsafe.plugin.version>
<serenity.cucumber.version>2.6.0</serenity.cucumber.version>
<maven.compiler.version>3.8.1</maven.compiler.version>
<maven.plugin.version>3.0.0-M5</maven.plugin.version>
<parallel.tests>4</parallel.tests>
<tags></tags>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-screenplay-rest</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest.assured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-rest-assured</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-cucumber</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.plugin.version}</version>
<executions>
<execution>
<id>Run parallel tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<forkCount>${parallel.tests}</forkCount>
<reuseForks>true</reuseForks>
<includes>**/TestRunner*.java</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.version}</version>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I did try to change various version of surefire and failsafe version, but still no luck. I did try -Dcucumber.filter.tags="@UI" but still no luck, it did not throw specific error but state build failure.
Expectaton: Tags should be parsed and run selected test ?
Upvotes: 0
Views: 73
Reputation: 119
You are using an incorrect option for tags.
Please try:
mvn verify -Dcucumber.filter.tags="@UI"
Upvotes: 0