JBehaveis an open source BDD framework originally written by Dan North, the inventor of BDD. It is strongly integrated into the JVM world, and widely used by Java development teams wanting to implement BDD practices in their projects.
In JBehave, you write automate your acceptance criteria by writing test stories and scenarios using the familiar BDD "given-when-then" notation, as shown in the following example:
Scenario: Searching by keyword and category Given Sally wants to buy some antique stamps for her son When she looks for ads in the 'Antiques' category containing 'stamps' Then she should obtain a list of ads related to 'stamps' from the 'Antiques' category
You then implement the test steps in Java, e.g.
public class SearchScenarioSteps {
@Steps
BuyerSteps buyer;
@Given("Sally wants to buy a $present for her son")
public void buyingAPresent(String present) {
buyer.opens_home_page();
}
@When("she looks for ads in the $category category containing $keyword in $region")
public void adSearchByCategoryAndKeywordInARegion(String category,String keyword,String region){
buyer.chooses_region(region);
buyer.chooses_category_and_keywords(category, keyword);
buyer.performs_search();
}
@Then("she should obtain a list of $category ads containing the word $keyword from advertisers in $region")
public void resultsForACategoryAndKeywordInARegion(String category,String keyword,String region){
buyer.should_only_see_results_with_titles_containing(keyword);
buyer.should_only_see_results_from_region(region);
buyer.should_only_see_results_in_category(category);
}
}
Learn more about the Thuydides JBehave integration in the User's manual.
Copyright © 2007 - 2012 Wakaleo Consulting
Thucydides development is lead and supported by Wakaleo Consulting,
a Sydney-based company that helps organisations optimize their software
development process. We provide consulting, training and mentoring
services in Agile Development Practices such as Continuous Integration,
Test-Driven Development, Acceptance-Test Driven Development,
Build Automation, Code Quality Practices and Automated Web Testing.