Simple hello world app - Cucumber

I just found out about Cucumber and it seems to be more prone to behavior-based testing. Or not?

In addition, I got this sample code:

public class HelloStepdefs { private Hello hello; private String hi; @Given("^I have a hello app with \"([^\"]*)\"$") public void I_have_a_hello_app_with(String greeting) { hello = new Hello(greeting); } @When("^I ask it to say hi$") public void I_ask_it_to_say_hi() { hi = hello.sayHi(); } @Then("^it should answer with \"([^\"]*)\"$") public void it_should_answer_with(String expectedHi) { assertEquals(expectedHi, hi); } } 

From my understanding, this class initiates the Hello class due to the @Given annotation, then if the method annotated using @When , it will call the method with the @Then annotation?

In any case, Cucumber seems very interesting, however, how it works with existing design patterns, as well as with existing infrastructures such as Spring, etc.

In addition, how can this be used when working with database-oriented projects.

+4
source share
1 answer

The cucumber is really a BDD tool, and it sprang from the rubies community. cucumber-jvm is a java implementation.

Relatively Given / When / Then , these are aliases for individual steps in function files, and the ruby ​​does not distinguish between them. But they are valuable because they provide context to the various stakeholders who create, implement, or read functions.

In terms of integration with spring, cuke4duke may correspond to the score.

+2
source

All Articles