Cucumber

Cucumber was originally a Ruby BDD framework. These days it supports several languages including Java. It provides functionality that is very similar to JBehave.

Let's see the same examples written in Cucumber.

The same as any other dependency we have used until now, Cucumber needs to be added to build.gradle before we can start using it:

dependencies { 
    testCompile 'info.cukes:cucumber-java:1.2.2' 
    testCompile 'info.cukes:cucumber-junit:1.2.2' 
} 

We will create the same steps as we did with JBehave, using the Cucumber way:

@Given("^I go to Wikipedia homepage$") public void goToWikiPage() { open("http://en.wikipedia.org/wiki/Main_Page"); } @When("^I enter the value (.*) on a field named (.*)$") public void enterValueOnFieldByName(String ...

Get Test-Driven Java Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.