errors from scenarios are rethrown after the full scenario has been described

Our goal with JBehave 2 was to make a framework that was lightweight, easy to use and didn’t take as long to set up as JBehave 1. To that end, we’ve been driving this entirely from example code – no guessing, unless it’s obvious – and we’ve ended up with something that works quite a lot like RSpec’s story runner, but for Java.

To use it, simply name your scenario file with underscores, eg: i_can_toggle_a_cell and define steps in it thus:

Given a 5 by 5 game
When I toggle the cell at (2, 3)
Then the grid should look like
.....
.....
.....
..X..
.....
When I toggle the cell at (2, 4)
Then the grid should look like
.....
.....
.....
..X..
..X..
When I toggle the cell at (2, 3)
Then the grid should look like
.....
.....
.....
.....
..X..

Then extend the Scenario class with a similarly named Java class:ICanToggleACell.java

Extend the Steps class – this is where your steps will be defined, and you can have as many as you want