Skip to content

Support for Cucumber Engine #142

@Leon0402

Description

@Leon0402

I tried this sbt plugin with cucumber for JUnit5. It uses the JUnit Suite Engine for configuration.

I use these libraries:

libraryDependencies += "io.cucumber" %% "cucumber-scala" % "8.26.1" % Test
libraryDependencies += "io.cucumber" % "cucumber-junit-platform-engine" % "7.21.1" % Test
libraryDependencies += "org.junit.platform" % "junit-platform-suite" % "1.11.4" % Test
libraryDependencies += "org.junit.jupiter" % "junit-jupiter-api" % "5.11.4" % Test
libraryDependencies += "com.github.sbt.junit" % "jupiter-interface" % "0.13.3" % Test
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % Test

and this configuration:

package steps

import org.junit.platform.suite.api.{SelectPackages, Suite}
import org.junit.platform.suite.api.SelectClasspathResource

@Suite
@SelectClasspathResource("features/example.feature")
class RunCucumberTest

The output is:

org.junit.platform.commons.JUnitException: TestEngine with ID 'cucumber' failed to discover tests
Caused by: org.junit.platform.commons.PreconditionViolationException: Could not load class with name: Example feature
....
[info] Test run started (JUnit Platform Suite)
[info] Test classpath:features/example.feature 3 started
[info] Given step executed
[info] When step executed
[info] Then step executed
[info] Test run finished: 0 failed, 0 ignored, 1 total, 0.146s

I suspect that this plugin somehow executes the TestEngine twice. Once without my configuration (which fails) and once with (which succeeds). Although, I am not deep enough into the topic to say with certainty. Is this a bug / missing feature of this plugin, or did I misconfigure something?

I have created a minimal repo for reproduction:
https://github.com/Leon0402/Cucumber-Scala-with-JUnit5

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions