3

I have cucumber tests which I execute with a Junit 5 suite. The Cucumber tests are all executed, but the extensions are ignored.

The class to run the cucumber tests looks like this:

import cucumber.Extensions.TestExtension;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;

@Suite
@SelectClasspathResource("cucumber")
@ExtendWith(TestExtension.class)
public class Junit5Runner {
}

Running this executes all my cucumber tests, but the extension is ignored. Since @ExtendWith is part of a different engine then @Suite it does not seem to be compatible. I couldn't really find anything about this topic online. Is there no way to run Cucumber tests with Junit 5 and Junit 5 extensions?

Thanks in advance

der2te
  • 43
  • 2
  • 1
    No there is no way. Extensions are a Jupiter engine concept. Cucumber comes with its own test engine. Test engines do not share a common lifecycle. – johanneslink Nov 14 '22 at 12:17

0 Answers0