Test application uses 3.8.1 maven, 1.0.0 quarkus-cucumber, 4.8.1 selenium-java WebDriver on Java 17 to test a web application with a quarkus version 3.5.1 backend. We are switching from using cucumber-java to use quarkus-cucumber. I had to add more than just the quarkus-cucumber dependency described in the quarkus-cucumber documentation to the original pom to get the extension to build and execute without failing, because it could not find classes. Now I have two final issues.
#1. Intellij feature tests runs don't find features unless I hard code the feature path into the CucumberOptions as described in RunQuarkusCucumberTest.java. Otherwise I get warning: io.cucumber.core.runtime.FeaturePathFeatureSupplier get WARNING: No features found at classpath:/org
#2. Quarkus-cucumber reports are generated from the Intellij runs when the feature path is hardcoded in the CucumberOptions and ran with class org.RunQuarkusCucumberTest. Maven command line runs complete the WebDriver tests, but no cucumber reports are generated by quarkus-cucumber for the command line run. @RunWith(Cucumber.class) is used to execute the tests from the command line, but it's not executing RunQuarkusCucumberTest main method to generate the reports. How can I execute the CucumberQuarkusTest main method using mvn test command line?
maven command:
mvn test -Durl=https://localhost:8443/ -Dexecution_mode=Headful -Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR -Dcucumber.glue=org -Dcucumber.features=/data/workspace/org/autoTests/src/test/resources/data -Dcucumber.filter.tags=@DataLoader
Intellij Configuration Settings:
Main class: org.RunQuarkusCucumberTest
Feature or folder path: /data/workspace/org/autoTests/src/test/resources/data/dir/test.feature
RunQuarkusCucumberTest.java
import io.cucumber.junit.Cucumber;
import io.quarkiverse.cucumber.CucumberOptions;
import io.quarkiverse.cucumber.CucumberQuarkusTest;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
//features = { "classpath:data/dir/test.feature" },
plugin = {
"pretty",
"html:target/cucumber-reports/cucumber.html"
})
public class RunQuarkusCucumberTest extends CucumberQuarkusTest{
public static void main(String[] args) {
runMain(RunQuarkusCucumberTest.class, args);
}
}
pom.xml
<properties>
<maven.compliler.target>17</maven.compliler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.version>3.8.1</maven.version>
<selenium.version>4.8.1</selenium.version>
<rest-assured.version>5.3.0</rest-assured.version>
<jasypt-sprint31.version>1.9.2</jasypt-sprint31.version>
<json-simple.version>1.1.1</json-simple.version>
<json.version>20230227</json.version>
<junit.version>5.10.0</junit.version>
<aspectj.version>1.9.9.1</aspectj.version>
<lombok.version>1.18.24</lombok.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.5.1</quarkus.platform.version>
<quarkus-primefaces.version>3.13.5</quarkus-primefaces.version>
<quarkus-wiremock.version>0.0.2</quarkus-wiremock.version>
<primefaces-selenium.version>13.0.3</primefaces-selenium.version>
<cucumber.version>7.11.1</cucumber.version>
<jsonschema2pojo.version>1.0.1</jsonschema2pojo.version>
<jackson-core.version>2.15.3</jackson-core.version>
<gson.version>2.10.1</gson.version>
<jblocks-dataheaders.version>6.1.0</jblocks-dataheaders.version>
<jsoup-version>1.16.2</jsoup-version>
<github-version>5.2.0</github-version>
<assertj-version>3.21.0</assertj-version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkiverse.cucumber</groupId>
<artifactId>quarkus-cucumber</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>jblocks</groupId>
<artifactId>jblocks-dataheaders</artifactId>
<version>${jblocks-dataheaders.version}</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup-version}</version>
</dependency>
<dependency>
<groupId>com.github.f4b6a3</groupId>
<artifactId>uuid-creator</artifactId>
<version>${github-version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
<version>3.9.5</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.9.5</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<version>${quarkus.platform.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.cucumber</groupId>
<artifactId>quarkus-cucumber</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.primefaces</groupId>
<artifactId>quarkus-primefaces</artifactId>
<version>${quarkus-primefaces.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.primefaces</groupId>
<artifactId>quarkus-primefaces-extensions</artifactId>
<version>${quarkus-primefaces.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${json-simple.version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json.version}</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt-spring31</artifactId>
<version>${jasypt-sprint31.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-core</artifactId>
<version>${jsonschema2pojo.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-core.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<includes>
<include>**/RunQuarkusCucumberTest.java</include>
</includes>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<goals>
<goal>sources</goal>
<goal>resolve</goal>
</goals>
<configuration>
<classifier>javadoc</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I solved my own problems.
Problem #1:
In order to get Intellij to run the quarkus-cucumber test and find the feature, I removed CucumberOptions annotation from and used a cucumber.property file instead. The quarkiverse CucumberOptions appears to be all or nothing regarding features, glue and plugin. When I used cucumber-java, there was no problem listing just the pretty print plugin in CucumberOptions and configuring the glue and feature in the Intellij feature file run/debug configuration. Quarkiverse cucumber does not like that.
You have to prefix "classpath:" before features and glue directory name.
cucumber.properties file:
cucumber.plugin=org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter,pretty,html:target/cucumber-reports/cucumber.html
To find the right cucumber.plugin values to use I had to step into the cucumber-core guts to see what was going on. This property file will run the cucumber test and also generate cucumber reports from Intellij.
Problem #2: To generate cucumber reports from maven command line: added
Web Driver Tests run and generate cucumber reports from Intellij run and maven test command line runs.