Class CucumberSpringContextConfiguration

java.lang.Object
com.datengaertnerei.test.dataservice.cucumber.CucumberSpringContextConfiguration

@SpringBootTest(webEnvironment=RANDOM_PORT) public class CucumberSpringContextConfiguration extends Object
Example Cucumber context and step definitions for REST API testing
  • Field Details

    • restTemplate

      @Autowired protected org.springframework.boot.test.web.client.TestRestTemplate restTemplate
      autowired test template (see Spring Boot doc)
    • serverPort

      @LocalServerPort protected int serverPort
      local server port will be dynamic
  • Constructor Details

    • CucumberSpringContextConfiguration

      public CucumberSpringContextConfiguration()
  • Method Details

    • before

      @BeforeEach public void before()
      setup test env
    • getBankAccount

      @When("the client asks for bank account in {word}") public void getBankAccount(String city)
      feature file matching "When"
      Parameters:
      city - the city to fetch a bank for
    • theClientReceivesStatus

      @Then("the client receives status code OK") public void theClientReceivesStatus()
      feature file matching "Then"
    • theClientReceivesProduct

      @And("the client receives bank account in this city") public void theClientReceivesProduct()
      feature file matching "And"