Simon Kent | 10 Nov 18:30 2014

Version 3.9.5 Only displays last story duration in report view?


We were testing out an upgrade to JBehave 3.9.5 and noticed that our story reports only showed the duration of the last story run (we run all tests in one class).

On examination it looks like the write method in StoryManager always created a new durations file (see extract below). This is presumably the change for JBEHAVE-1041.

In previous versions (we were using 3.7.5) the report correctly showed the durations for all the stories.

  private void write(Properties p, String name) {
        File outputDirectory = configuration.storyReporterBuilder().outputDirectory();
        try {
            Writer output = new FileWriter(new File(outputDirectory, name));
  , this.getClass().getName());
        } catch (IOException e) {

Simon Kent
QA Manager
T: 01454 802431
E: skent-/
Privileged or confidential information may be contained in this message. If you are not the addressee of this message please notify the sender by return and thereafter delete the message, and you may not use, copy, disclose or rely on the information contained in it. Internet e-mail may be susceptible to data corruption, interception and unauthorised amendment for which Gresham does not accept liability. Whilst we have taken reasonable precautions to ensure that this e-mail and any attachments have been swept for viruses, Gresham does not accept liability for any damage sustained as a result of viruses. Statements in this message that do not relate to the business of Gresham are neither given nor endorsed by the company or its directors. Gresham Computing plc Registered in England and Wales. Company No. 01072032 Registered Office: Aldermary House, 10-15 Queen Street, London, EC4N 1TX. Further information about Gresham Computing can be found on our website:
Brent Barker | 29 Oct 22:08 2014

Restarting Stories

Hi again,

Is there a way to restart a story if it has failed once before? I know there is a way to restart a scenario by throwing a RestartingScenarioFailure exception.

This would be useful for our selenium tests. There are countless things that can go wrong when running these browser tests. Since a false positive can cause people to quickly lose trust in the tests, others advised that this would be a good solution.

Thanks in advance!
Zheng, Ayesha(AWF | 15 Oct 05:27 2014

Issue about GivenStories & Examples

Hi all,


I have a problem about GivenStories.


Assume A.story has 2 or more scenarios:

Scenario: A - 1

Meta: <at> id1 scenario1

Given actions with <Apara1>

When …





Scenario: A-2

Meta: <at> id2 scenairo2

Given …

Examples: A2.table




B.story want to run only scenario A-1 for prepare with different data.


Scenario: B - 1

GivenStories: A.story#{id1:scenario1}#{0} à Problem here.

Given actions with <Bpara1> and <Bpara2>

When …







My problem is:

How can I use givenStories to match follow requirements:

1.       Run only Scenario A-1 in A.story.

2.       Pass data in Table Row 0 to givenStories A-1.

3.       Run Scenario B-1 with example data.


Thanks very much.



Best Regards,



kvitaliy | 9 Oct 12:15 2014

Examples and GivenStories

Hi All,

I have a problem with understanding of how to use GivenStories.

Assume, we have story file UserLogin.story with next text:

Scenario: user login
Meta:  <at> id1 userLogin

Given the user click on login button
When the user type '[login]'
AND the user type '[password]'
AND the user click on '[btn]'
Then something happens


Also, we have story in another file:

Scenario: scenario name

GivenStories: path/to/UserLogin.story

Given <<given conditions c1,c2,...,cK>>
When <<user actions with params p1,p2,...,pN>>
Then <<expectations e1,e2,...,eM>>

So, two questions:
1. How can I run this scenario only for first row from given story 
2. Is it possible to run UserLogin as precondition only (i mean, i don't 
want to run it outside scenarios, which depends on it)?


Best regards,

To unsubscribe from this list, please visit:

Dariusz Lorenc | 8 Oct 03:05 2014

Re: JBehave, maven and slf4j

Thanks for a quick reply. Really appreciate it.

I didn't know the jbehave is not using any logging framework. Now I'm really puzzled. Wonder if any of the jbehave's dependencies could cause that issue.

I did try with the logback dependencies at the plugin level, as you suggested. Unfortunately it didn't help at all.

I'm attaching a sample project which reproduces the issue. Hope it goes trough as an attachment. Just unzip it and run mvn integration-test.

You should see something like this, when it fails:

Then it should be a Logback instance (FAILED)
(org.junit.ComparisonFailure: expected:<[ch.qos.logback.classic.]Logger> but was:<[org.slf4j.impl.Simple]Logger>)

As you would see there is not much in that project. There is a unit test (LogTest) which check for the right Logger class name. And that seems to always pass. 
The LogShouldNotMisbehaveSteps class obtains logger in one step and asserts Logger's class name in another step. And that seems to fail when run from maven, but passes when run as junit from the IDE.

Give it a go, and please let me know if you find anything interesting. 


On Tue, Oct 7, 2014 at 6:14 PM, Mauro Talevi <mauro.talevi <at>> wrote:
There's nothing dodgy about log-related in JBehave, simply because there is no logging framework used.

What's usually quite dodgy is the logging frameworks' classloading and dynamic lookups, which don't play well with Maven's rather strict classloading.

To overcome classloading issues, it should suffice to declare your logging framework's dependencies at plugin level, rather than project level:

If it doesn't work then please us send a sample project that reproduces the issues.


On 07/10/2014 03:44, Dariusz Lorenc wrote:

I've been trying to get JBehave (3.9.4) to work in one of my projects, but I'm experiencing some odd behaviour with the slf4j binding. Hope somebody can help to pinpoint it, and confirm, or deny, that JBehave, or its maven plugin is a culprit here.

I'm using dropwizard (0.7.1) in my project which in turn uses logback, and comes with all the logback dependencies as well as slf4j-api etc. Based on that, Dropwizard seems to assume that org.slf4j.LoggerFactory.getLogger(...) would always return an implementation of ch.qos.logback.classic.Logger (they cast the result to that Logger type).

I have a very simple JBehave test, which tries to start up the service (dropwizard). When I run it from eclipse, everything works fine. However when I run it from maven, when dropwizard's service is starting up, I'm getting an exception like this: 

Caused by: java.lang.ClassCastException: org.slf4j.impl.SimpleLogger cannot be cast to ch.qos.logback.classic.Logger
at io.dropwizard.logging.LoggingFactory.bootstrap(
at io.dropwizard.logging.LoggingFactory.bootstrap(
at io.dropwizard.Application.<clinit>(
That is caused by the dropwizard code trying to do that cast. For some reason, in that scenario only, slf4j's getLogger returns org.slf4j.impl.SimpleLogger. I checked my classpath/dependencies to make sure I don't include the slf4j-simple jar anywhere. The only slf4j bindings I have is the native logback implementation, which comes with dropwizard. No slf4j-simple jar, no org.slf4j.impl.SimpleLogger on my classpath. So how come it shows up in the runtime when running from maven?

I even tried to strip the project down completely. I removed dropwizard, and just left slf4-api, logback and jbehave. The JBehave test was modified to just print out the class name of the logger retrieved by the same getLogger method.
And same result again - SimpleLogger (slf4j-simple) when running from maven, logback logger when running from the IDE.

To prove it's somehow JBehave related, I created a plain junit test (no jbehave), which just prints out the logger's class name. It always returns the right logback Logger, when run from eclipse or maven.

So it seems to be only maven-JBehave combination which always results with slf4j-simple binding. That makes me think that JBehave (or actually its maven plugin) could be doing something (dodgy?) log related under the hood. Could somebody confirm that? And if so, does anybody know a good workaround? Apart from Cucumber, of course :)

Any help is much appreciated.


Attachment ( application/zip, 8 KiB

To unsubscribe from this list, please visit:
Brent Barker | 25 Sep 22:21 2014

AfterScenario execution

Hi again,

I noticed from upgrading JBehave 3.9.2 to 3.9.3, the order which AfterScenario was executed changed.

Our method annotated with <at> AfterScenario() takes a screenshot of the failure in the scenario, and continues on to the next scenario.

A story with this:
Outcome: ANY
Given I login as a Admin
Then I am able to clean up my data

It used to take a screenshot (executing the <at> AfterScenario()) before performing the after lifecycle steps. In 3.9.3, this is no longer the case

Is there some documentation regarding the order lifecycle steps should be executed, depending on failures?

If it helps, I can try to put together an example project that demos this behavior.

Zheng, Ayesha(AWF | 19 Sep 11:23 2014

Parametrised scenario problem

Hi all,


I have a scenario:


Given a user open homepage

Then should see <message1>

When user do something and go to another page

Then should see <message2>





And test.table with content:




And step “Then should see <message1>” and “Then should see <message2>” do the same thing: just check the text.

So I just want to implement it once time.

Code like:

<at> Then("should see <message>")

public void shouldSeeMsg( <at> Named("message")String message)


    // check text…



When running this case, I hope it can match both step “<message1>” and “<message2>”.

But the problem is, I found the parameter name in code must be the same with the name specified in scenario.

These steps always in PENDING status.


Could anyone help to how to solve this?

Thanks very much.


Best Regards,



Hans Schwäbli | 17 Sep 09:33 2014

CTRL+F does not work in JBehave editor

As it seems CTRL+F for searching text does not work inside the JBehave editor.
What do you think, would that be a good idea to add that feature to the JBehave editor?
Viktor Farcic | 15 Sep 11:29 2014

BDD Assistant

I wrote an OSS application for writing, managing and running JBehave stories. I'd be grateful you someone would give me feedback.

Chad Wilson | 13 Sep 02:46 2014

When hook

Is there any way to run something before all When steps?


To unsubscribe from this list, please visit:

Zheng, Ayesha(AWF | 12 Sep 03:53 2014

Stories' Dependency

Hi all,


I have a problem with stories’ dependency.



I have A,B,C stories, and stories B, C depends on A. (B->A, C->A).

I add “GivenStories: A.story” in both B.story and C.story to do this, then run these 3 stories.

I found A.story run for 3 times.


I want to make A,B,C stories run only one time and keep dependency at the same time. (Like testng: dependsOnMethods)

Does JBehave support this?


Thanks very much.



Best Regards,