I have a Maven / Spring Boot 2.3.3 application with JUnit 5 and Cucumber (v6.5.1) tests.
The thing is that I can run OK either Unit and Integration tests via Maven, but it does not run Cucumber.
Cucumber Runner:
package cucumber.salad.api.integration.cucumber;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "classpath:features",
plugin = { "pretty", "html:target/reports/cucumber", "json:target/cucumber.json", "usage:target/usage.jsonx", "junit:target/junit.xml" },
extraGlue = "cucumber.salad.api.integration.cucumber.steps"
)
public class CucumberTest {
}
Cucumber Spring Context Config:
package cucumber.salad.api.integration.cucumber;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.ContextConfiguration;
import cucumber.salad.App;
import io.cucumber.spring.CucumberContextConfiguration;
@ContextConfiguration
@CucumberContextConfiguration
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
public class CucumberSpringContextConfig {
@LocalServerPort
protected int port;
}
Steps:
package cucumber.salad.api.integration.cucumber.steps;
import static org.assertj.core.api.Assertions.assertThat;
import org.springframework.beans.factory.annotation.Autowired;
import cucumber.salad.api.integration.cucumber.CucumberSpringContextConfig;
import cucumber.salad.api.service.DummyService;
import io.cucumber.java.en.*;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SaladStepDefinitions extends CucumberSpringContextConfig {
// steps here
}
I use Surefire and Failsafe in the Maven pom.xml: https://github.com/danieldestro/cucumber-salad/blob/master/pom.xml
Here is the project repository: https://github.com/danieldestro/cucumber-salad
Command I run:
mvn clean test integration-test
But there is not a sign from Cucumber test execution.
I am missing anything or doing something wrong?