JBehave is a framework for Behaviour-Driven Development (BDD). But for more info you should go to the JBehave website. This module is the glue between Unitils and JBehave.
If you are using maven, you can add following dependency to your project.
| 01 02 03 04 05 | <dependency>    <groupId>org.unitils.jbehave</groupId>    <artifactId>unitils-jbehave</artifactId>    <version>1.0.2</version></dependency> | 
Please create unitils-local.properties, and add jbehave to unitils.modules. Code as following:
| 01 02 03 04 05 06 07 08 09 10 11 | unitils.modules= ...,mail,webdriver,...#Add this to your unitils.properties if you need the MailModule as well.unitils.module.mail.className = org.unitils.jbehave.modules.JBehaveMailModuleunitils.module.mail.runAfter=unitils.module.mail.enabled=true#Add this to your unitils.properties if you need the WebdriverModule as well.unitils.module.webdriver.className = org.unitils.jbehave.modules.JBehaveWebdriverModuleunitils.module.webdriver.runAfter=unitils.module.webdriver.enabled=true | 
You have f.e. a Mail story with a few scenarios where you want to check if a mail has been sent or not. This is just an example story ...
| 01 02 03 04 05 06 07 08 | Scenario:  send correct emailGiven send an email to  willemijn.wouters@unitils.beThen check if the email is sentScenario: send correct email with correct headerGiven send an email with willemijn.wouters@unitils.be with header just a testheaderThen check if the email has the correct header | 
... with a few fictive steps
| 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | publicclassSimpleMailStep {            @BeforeStories    publicvoidbeforeStories() {        System.out.println("In before stories: "+ getClass());    }             @TestSmtpServer    privateSmtpServer smtpServer;    privateSimpleSender mailSender;    privateString address;    @BeforeScenario    publicvoidbeforeScenarioPhase() {        String port = (String) Unitils.getInstance().getConfiguration().get(MailModule.SMTP_DEFAULT_PORT);        mailSender = newSimpleSender(Integer.valueOf(port));    }    @Given("send an email to $mailAddress")    publicvoidsoSomeSetUp(@Named("mailAddress") String address) throwsMessagingException, IOException {        mailSender.sendMessage("sender@here.com", "TestHeader", "Test Body", address);        this.address = address;    }    @Then("check if the email is sent")    publicvoiddoSomeChecks() throwsIOException, MessagingException {        //... do some assertions...    }} | 
unitils-jbehave does most of the config for you, but you need to give the story(s)/step(s). 
For this test I need my Mail.story, SimpleMailStep and SimpleMailStep2.
| 01 02 03 04 05 06 07 08 09 10 11 12 13 14 | publicclassSimpleMailTest extendsUnitilsJUnitStories {    /**     * @see org.unitils.jbehave.UnitilsJUnitStories#configureJBehave()     */    @Override    publicJBehaveConfiguration configureJBehave() {        returnsuper.configureJBehave()            .addSteps(newSimpleMailStep())            .storyFile("Mail.story")            .storyPackage("org/unitils/jbehave/stories");    }} | 
Ofcourse you can use the annotations in the steps but if you reuse youre steps in multiple scenarios than it might be useful to put a meta tag in your story file.
At the moment there are three tags that you can use.
If you want to use this feature than you have to override the configureJBehave() method in your testclass and add the following...
| 01 02 03 04 05 06 07 08 09 | /** * @see org.unitils.jbehave.UnitilsJUnitStories#configureJBehave() */@OverridepublicJBehaveConfiguration configureJBehave() {    returnsuper.configureJBehave()        .useDatabaseSteps()        .addSteps(newSimpleMailStep());} | 
An example of how your story would look like:
| 01 02 03 04 05 06 07 08 09 10 11 | Meta: @SqlScript path/to/script.sql @Dataset path/to/dataset.xmlScenario: Title Meta: @Dataset path/to/scenario/dataset.xml @ExpectedDataset path/to/scenario/expected-dataset.xml Given ... When ... Then ... | 
Warning: If you put f.e. an @Dataset meta tag on story and scenario level, than the meta tag on scenario level overrides the meta tag on story level. The meta tag @SqlScript is always executed before the @DataSet meta tag.
There is also an extra meta tag for Testlink, for if you want to use our unitils-testlink module in combination with JBehave.
If you want to use this feature than you have to override the configureJBehave() method in your testclass and add the following...
| 01 02 03 04 05 06 07 08 09 | /** * @see org.unitils.jbehave.UnitilsJUnitStories#configureJBehave() */@OverridepublicJBehaveConfiguration configureJBehave() {    returnsuper.configureJBehave()        .addSteps(newSimpleMailStep())        .addFormat(UnitilsFormats.TESTLINK);} | 
An example of how your story would look like:
| 01 02 03 04 05 06 | Scenario: Title Meta: @TestLinkId PRJ-4 Given ... When ... Then ... | 
You should add the correct properties in the unitils.properties for unitils-testlink to make it completely work.
If you want that unitils-selenium automatically creates a screenshot when a step fails, than you can add the SeleniumScreenshotReporter to your configuration.
| 01 02 03 04 05 06 07 08 09 10 11 | /** * @see org.unitils.jbehave.UnitilsJUnitStories#configureJBehave() */@OverridepublicJBehaveConfiguration configureJBehave() {    SeleniumSteps yourSeleniumSteps = newSendMailSeleniumSteps();    returnsuper.configureJBehave()        .addSteps(yourSeleniumSteps)        .addStoryReporter(newSeleniumScreenshotReporter("screenshots", yourSeleniumSteps))        .addStepsWithSeleniumReporter(newSendMailSeleniumSteps(), "screenshots");} | 
YourSeleniumSteps implements the org.unitils.jbehave.core.reporters.SeleniumSteps interface and contains a ScreenshotTakingwebdriver that can be used in your steps. In this case the screenshots are created in the "screenshots" directory in your target directory.
Jbehave creates rapports in the target/jbehave folder. This is an overview of all the succeeded and failed tests.
 
If there is something wrong, than you can click on the story to check which scenarios are passing and which are failing and why it is failing.
