Im using:
I want to start single scenarios using this button:
However, when I do so the test always runs into the error:
Suppressed: io.cucumber.java.InvalidMethodSignatureException: A method annotated with Before, After, BeforeStep or AfterStep must have one of these signatures:
* public void before_or_after(io.cucumber.java.Scenario scenario)
* public void before_or_after()
at org.citrusframework.cucumber.CitrusLifecycleHooks.before(org.citrusframework.cucumber.backend.Scenario)
But in fact my before method has the correct singature:
@Before
public void before_or_after() {
}
And when I run my tests using the TestRunnerIT
I wrote, the
tests are all running fine:
@RunWith(Cucumber.class)
@CucumberOptions
(
plugin =
{
"pretty",
"org.citrusframework.cucumber.CitrusReporter"
},
features =
{
"classpath:gherkin"
}
)
public class TestRunnerIT {
}
What can I do to make running single scenarios from feature file possible? Seems like the whole spring context is missing when starting a scenario in that way.
EDIT
added pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.project.my</groupId>
<artifactId>test-service</artifactId>
<version>${revision}${changelist}</version>
<name>test-service</name>
<properties>
<revision>0.4.5</revision>
<changelist></changelist>
<!-- cucumber -->
<cucumber.version>7.15.0</cucumber.version>
</properties>
<dependencies>
<!-- Spring Dependencies Start -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Spring Dependencies End -->
<!-- Cucumber Dependencies Start -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<!-- Cucumber Dependencies End -->
<!-- Lombok start -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- Lombok end -->
<!-- Test Dependencies Start -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<!-- Test Dependencies End -->
</dependencies>
</project>
Solution for me: Add the glue to the run configuration!