пишу огурец BDD контрольные примеры. Все зависимости огурца включены в пом. xml
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.trivago.rta</groupId>
<artifactId>cluecumber-report-plugin</artifactId>
<scope>test</scope>
<version>2.3.3</version>
</dependency>
В моем файле определения шага я включил аннотацию SprintBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class AccessProfileStepDefinition {
private final Logger log = LoggerFactory.getLogger(AccessProfileStepDefinition.class);
// Location of input payload, which will be used to send request to api server.
private static final String root_folder = "/testdata/bdd/json_for_accessprofile/";
private final static String create_useraccessprofile_payload = root_folder + "create_access_profile_req.json";
@Autowired
private AccessProfileHttpClient httpClient;
@Given("I am cbx system user")
public void i_am_cbx_system_user() {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java.PendingException();
}
Я получаю ошибку - когда я запускаю тест
mvn -DAccessProfileFeatureBDDTest clean test
java .lang.IllegalStateException: невозможно найти @SpringBootConfiguration, вам нужно использовать @ContextConfiguration или @SpringBootTest (classes = ...) с вашим тестом
Если я прокомментирую предложение @Given в моем файле определения шага, то я не получу сообщение об ошибке, связанной с @ SpringBootConfiguration
Другие файлы. ниже
package com.igtb.dcp.cbxaccessprofile.bdd;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources/features/accessprofile/", plugin = {
"json:target/cucumber-report/cucumber.json", "com.igtb.dcp.cbxaccessprofile.bdd.TestInitialization" })
public class AccessProfileFeatureBDDTest {
}
accessprofile.feature имеет функцию и содержится в src / test / resources / features / accessprofile / folder