setting up test data in DB for jBehave test stories
Question
I wish to use jBehave in completeness as an integration testing framework and therefore I need some definite way of setting up the Test data in the database before I begin with a particular test story something similar to using DbUnit with jUnit where we define the test data XMLs for each test case. Is there a way to achieve this with or with out DbUnit ?
Solution
The spring-security example that is contained in JBehave examples does exactly that. It uses DbUnit to wipe out the database as a @BeforeStory.
If you want specific data, then you might want to create GivenStories or have Givens that load specific data files.
@Given("the gold status users")
public void loadGoldStatusUsers() {
dbunitLoader.load("/goldStatusUsers.xls");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow