Best Java BDD Platform with Data-Driven-Development?

I'm looking for a behavior-oriented Java development environment that integrates well with data-driven development (parameterized values). I started using easyb , but it doesn't seem to be very data friendly. Looking at the JBehave documentation , it looks like a more consolidated structure, someone used one of the frames for the hose with Selenium (Maven project) with CSV or JSON files as feeds.

Greetings

+3
source share
1 answer

You can use JGiven with JUnit and JUnit-DataProvider . Then you can write tests like this:

@Test
@DataProvider( {
    "0, 0, Error: No coffees left",
    "0, 1, Error: No coffees left",
    "1, 0, Error: Insufficient money",
    "0, 5, Error: No coffees left",
    "1, 5, Enjoy your coffee!",
} )
public void correct_messages_are_shown( int coffeesLeft, int numberOfCoins, String message ) {
    given().a_coffee_machine()
        .and().there_are_$_coffees_left_in_the_machine( coffeesLeft );

    when().I_insert_$_one_euro_coins( numberOfCoins )
        .and().I_press_the_coffee_button();

    then().the_message_$_is_shown( message );
}

Full example can be found on GitHub

Disclaimer: I am the author of JGiven

+2
source

All Articles