1

I have to start integration testing in a new springboot project and I'm struggle with Junit and Cucumber.

Java 23
Spring Boot 3.4.3
Gradle
Cucumber 7.20.1
Junit 5

I added these dependencies

    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

    // Add Cucumber dependencies
    testImplementation 'io.cucumber:cucumber-java:7.20.1'
    testImplementation "io.cucumber:cucumber-java:7.20.1"
    testImplementation "io.cucumber:cucumber-spring:7.20.1"
    testImplementation "io.cucumber:cucumber-junit-platform-engine:7.11.0"
    testImplementation 'org.junit.platform:junit-platform-suite:1.12.0'
    testImplementation 'org.junit.platform:junit-platform-engine:1.12.0'

I created a runner class

@Suite
@IncludeEngines("cucumber")
@SpringBootTest
@CucumberContextConfiguration
@SelectClasspathResource("features")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.example.democucumber")
public class RunAllCucumberTests {
}

And this is the structure of the project :

Project structure

When I run gradle, I have

org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for Gradle Test Executor 6.
Caused by: org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-platform-suite' failed to discover tests
Caused by: org.junit.platform.commons.JUnitException: TestEngine with ID 'cucumber' failed to discover tests

I can't get the runner to work, and I don't understand why the tests aren't being found. Does anyone have any idea, or perhaps a project skeleton with Spring 3 / Gradle / JUnit 5 / Cucumber, please?

2
  • You are using the cucumber-junit-platform-engine:7.11.0 which doesn't align with the other versions. Commented Mar 15 at 10:18
  • You are also using Spring boot which has its own system for managing JUnit dependencies: junit.org/junit5/docs/5.12.0/user-guide/… Commented Mar 15 at 10:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.