@Autowired бросает нулевой указатель в файл StepDef - PullRequest
1 голос
/ 26 мая 2020

Конфигурация бегуна огурца: путь: /test/java/com.example.ndod

@RunWith(Cucumber.class)
@CucumberOptions(features = "classpath:feature",plugin = {"pretty"})
public class NdodApplicationTests {
}

Файл определения шага: путь: /test/java/com.example.ndod

@SpringBootTest
public class NdodStepdefs{

    @Autowired
    Service service;

...
}

Файл функции: путь: / test / resources

Feature: Ndod RestAPI

  Scenario: Call NdodApi to get JSON result
    Given Create a NdodApi
    When Call NdodApi with "ATS8594"
    Then Get result in Json

pom. xml:

<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.6</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.6</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-spring -->
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-spring</artifactId>
            <version>1.2.6</version>
            <type>pom</type>
            <scope>test</scope>
        </dependency>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...