'CucumberOptions doesn't run features
After a few years of coding in Cucumber I got strange error when trying to execute the tests:
Exception in thread "main" java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description;
at io.cucumber.junit.FeatureRunner.getDescription(FeatureRunner.java:118)
at io.cucumber.junit.Cucumber.describeChild(Cucumber.java:191)
at io.cucumber.junit.Cucumber.describeChild(Cucumber.java:89)
at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:290)
at com.intellij.junit4.JUnit4IdeaTestRunner.getDescription(JUnit4IdeaTestRunner.java:79)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:51)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
TestRunner class:
package codelab.runners;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
glue = {"codelab.step", "codelab.page", "codelab.hooks", "codelab.helpers", "codelab.api"},
features = "src/test/resources/features/",
plugin = {"json:target/cucumber.json", "pretty"})
public class TestRunner {
}
The error is strictly related to feature path provided in @CucumberOptions annotation. The path is correct and I have no idea why it suddenly stopped working...
POM.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>codelab</groupId>
<artifactId>babel_guru_selenium</artifactId>
<version>1.0</version>
<properties>
<projectName>BabelGuru</projectName>
<reportInputDirectory>${project.build.directory}</reportInputDirectory>
<reportOutputDirectory>${project.build.directory}/cucumber-report-html</reportOutputDirectory>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>selenium</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/src/test/resources/lib/JARs/SeleniumHelper.jar</file>
<groupId>codelab</groupId>
<artifactId>SeleniumHelper</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<pomFile>D:/projects/quality_assurance/Engines/SeleniumHelper/pom.xml</pomFile>
</configuration>
</execution>
<execution>
<id>webdriver</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/src/test/resources/lib/JARs/WebDriverFactory.jar</file>
<groupId>codelab</groupId>
<artifactId>WebDriverFactory</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<pomFile>D:/projects/quality_assurance/Engines/WebDriverFactory/pom.xml</pomFile>
</configuration>
</execution>
<execution>
<id>restAssured</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/src/test/resources/lib/JARs/RestAssuredEngine.jar</file>
<groupId>codelab</groupId>
<artifactId>RestAssuredHelper</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<pomFile>D:/projects/quality_assurance/Engines/RestAssuredHelper/pom.xml</pomFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<filtering>true</filtering>
<directory>./src/main/resources/profiles/${build.profile.id}</directory>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</dependency>
<dependency>
<groupId>codelab</groupId>
<artifactId>RestAssuredHelper</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>codelab</groupId>
<artifactId>SeleniumHelper</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>codelab</groupId>
<artifactId>WebDriverFactory</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>[4.10]</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>local</id>
<properties>
<build.profile.id>local</build.profile.id>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<build.profile.id>dev</build.profile.id>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<build.profile.id>test</build.profile.id>
</properties>
</profile>
</profiles>
</project>
Any help would be really appriciated. Thanks :)
Solution 1:[1]
Hmm this is a tough one. I am not really sure why are you specifying the glue path to classes like "step", "hooks", "helpers" etc. The glue path defines the package in which stepDefinitions are found. This is an example from one of my projects:
@RunWith(Cucumber.class)
@CucumberOptions( monochrome = true,
tags = "@tags",
features = "src/test/resources/",
format = { "pretty","html: cucumber-html-reports",
"json: cucumber-html-reports/cucumber.json" },
dryRun = false,
glue = "stepMethods" )
stepMethods being the package where my step definitions are. Maybe just try and go with this (in your scenario):
glue = "codelab"
Good luck :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Funky Monkey |
