最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

build.gradle - SpringBoot 3 + Junit5 + Cucumber : Junit Runner don't see cucumber tests - Stack Overflow

programmeradmin1浏览0评论

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 '.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 '.junit.platform:junit-platform-suite:1.12.0'
    testImplementation '.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

.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for Gradle Test Executor 6.
Caused by: .junit.platformmons.JUnitException: TestEngine with ID 'junit-platform-suite' failed to discover tests
Caused by: .junit.platformmons.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?

发布评论

评论列表(0)

  1. 暂无评论