Josef Dietl | 6 Mar 14:36 2014

RE: JBehave learning curve

Hi Janusz,


Thanks for taking up this topic. I was having similar problems to get started, and for organizational reasons, I couldn’t approach the group.


I don’t mean to offend anybody. Everybody here is incredibly helpful, and the software is really great. But the learning curve is wild. Given the deep questions I saw here while lurking, I wasn’t exactly inspired to step up, despite all the helpful attitude of Mauro and everybody.


A bit about myself: I’m not a full-time developer, I’m a project manager with a passion for continuous improvement of our development practices. I’m good enough to occasionally find something in a code review, to make a prototype or an automated test, but my focus is on providing the optimal environment for the development team so that they can maximize their productivity. So in order to get them to look at JBehave and [T|AT|B]DD, I had to learn Maven and set up JBehave on my own in a branch of the project to demonstrate the value-add.


To cut a long story short, once I was through, adding stories and tests on top of the existing set-up was cool and convincing, but the path there could have been smoother.


When I was working for the W3C, we had a saying: make the simple things simple and the hard things possible. JBehave doesn’t exactly work like that, but once I had reached the “hard” things, I also found traction in the documentation and the sample projects.


I don’t have the role to suggest anything here, but I did ask myself repeatedly whether it wouldn’t be possible to be more explicit about the first steps. Back then, I’ve tried my best here -> (unfortunately German). If a check with Google Translate suggests that this is basically useful, I’d translate and tweak this and its sibling post (below) as needed and contribute it.


Re-reading the post, I find that I struggled most on these topics:

1.    What is the simplest possible working configuration of JBehave? (there’s a description on the site, but no full example… what are the main classes, what is their relationship to each other? What do I need to import from where? Reverse-engineering the thinking steps from the example projects just didn’t work for me.)

2.    Depending on JBehave configuration and Maven configuration: Where do I have to put this file, the stories and the step implementations?

3.    And then, specifically for my almost-simplest-possible set-up: how does all this relate with Spring.


In hindsight, the biggest problem was #2: Which file goes where… (or, more precisely, as everything is configurable: which configuration determines what goes where, and what are the defaults?)


For a slightly more advanced topic, there’s even a post in English:


I hope this helps. JBehave is really great, and I hope this message is advancing its progress.

Thank you all for your great work!


Best wishes,




From: Janusz Kowalczyk []
Sent: Donnerstag, 6. März 2014 12:58
To: user-b1QraVsTlj/
Subject: [jbehave-user] Why JBehave repo examples and website are the worst example of work ever created by the any of the open source communitties?


It's truly remarkable that I haven't gave up yet in my attempts to use JBehave many after days wasted on trying to figure out how to run examples give on the or the ones available in the project's repo. 


Does any of the project members heard of Developer Experience?

Are there any chances that this will change in near future or this project will keep to scare off more people?





Janusz Kowalczyk | 6 Mar 12:57 2014

Why JBehave repo examples and website are the worst example of work ever created by the any of the open source communitties?

It's truly remarkable that I haven't gave up yet in my attempts to use JBehave many after days wasted on trying to figure out how to run examples give on the or the ones available in the project's repo. 

Does any of the project members heard of Developer Experience?
Are there any chances that this will change in near future or this project will keep to scare off more people?

Brent Barker | 5 Mar 23:58 2014

Using Weld with a Selenium PageObject

We are trying to use Weld in our jbehave selenium project. I am wondering if anyone has a working example of this.

The problem we are running into is allowing the PageObjects to have a reference to other page objects. I know it is hard to describe this without some code to show. I just want to make sure there isn't already something out there that i'm not seeing.

Thanks in advance!
-Brent Barker
Johnny Wong | 3 Mar 14:30 2014

Using steps from another WebDriverStep class

Hi -- I'd like to build composite steps, where sub-steps may be specified in another class. Is this possible? When I tried it, it did not seem to find the outside-of-this-class steps.

To be clearer:

StepClass1 -> extends WebDriverStep
- StepA
- StepB

StepClass2 -> extends WebDriverStep
- StepC
- StepD
- CompositeStepAA: {StepA, StepC, StepB, StepD}  ==> This is what I am trying to accomplish

Both StepClass1 and StepClass2 are injected via the stepsFactory()

What is the best way to do the above? Should I have StepClass inherit from StepClass1 (but will that result in double steps?)

farheen khan | 3 Mar 07:07 2014

Q's on JBehave

I recently have implemented JBehave with webdriver for automation. I have few queries.

1. can JBehave store the results in DB after the suite is completed?
2. Can we modify the Jbehave report to display the buildnumber?
3. can we run webdriver tests to run from jbehave web runber.Example of doesn't actually run the webdriver stories.
4. Can we integrate the results with web-runner. i.e instead of opening target/view.index.html , can we host it on any webserver along with web-runner.

Thanks and regards
Farheen Khan

Brent Barker | 1 Mar 00:31 2014

Running stories as a Story Object

Is it possible to run a story as a Story object, and not have to specify a path?

Currently I'm retrieving stories from a online editor in the form of a json, and parsing that text into a story object via..

embedder.storyRunner().storyOfText(embedder.configuration(), storyText.toString(), "story name");

To run each story, I've had to execute them with..

embedder.storyRunner().run(embedder.configuration(), candidateSteps, story);

I've edited the Embedder and StoryManager in an attempt to run them natively, and it seems to work. However, I was wondering if there was a better way to do this or if there was already something setup to do this? I'd rather not write the stories to disk.

This stack overflow question gives some additional context to what I am trying to achieve

Thanks in advance!
Hans Schwäbli | 28 Feb 13:01 2014

Project specific settings not persisted?

I use Eclipse Kepler and changed the JBehave story language from "en" to "de" in the project settings (not in the Eclipse preferences). I enabled project specific settings for my project in the JBehave project preferences.
I supposed that this is saved in a [projectfolder]/.settings in a ".conf" file. But as it seems it is not persisted there.
Because of that I cannot check that into the Subversion code repository. Everyone who checks this project out has to configure the story language because this setting is not contained in any .prefs file in the .settings folder.
What seems to be persisted is only that project specific settings are enabled for JBehave preferences. But the chosen story language is not persisted.
Is it not meant to be persisted?
Hans Schwäbli | 27 Feb 15:45 2014

Reporting step documentation

Hello JBehave developers,
JBehave supports step documentation which is a cool feature. If I add a Javadoc comment to the method which implements a step, I can see that comment in the JBehave editor when I use code completion.

However this information is not integrated in the JBehave report. Or did I overlook a way to configure that in order to integrate it?

Would you suggest to create Javadoc HTML output in the classic way (with Ant or whatever) in order to produce this kind of report? Or do you intend to integrate step documentation into the JBehave report in a future version?

Bernardo Pinto | 24 Feb 14:33 2014

JBehave reusing instance variables in Examples Scenario

I have the following story:
Meta: Story proof of concept

Given I have a bank account
And my balance is 100

Scenario: Simple scenario
Meta: <at> simple

When I withdraw 10
Then my bank account balance should be 90

Scenario: Scenario with Examples
Meta: <at> examples

When I add <value>
Then my bank account balance should be <balance>


Scenario: Scenario with data tables
Meta: <at> tables

Given these people have bank accounts with balances:
When I take all their money
Then my bank account balance should be 1600

And have this Step implementation class:
public class BankAccountSteps extends Embedder {

    private BankAccount ba;
    private List<BankAccount> accounts = new ArrayList<BankAccount>();

    <at> Given("I have a bank account")
    public void I_have_a_bank_account(){ = new BankAccount("Me");

    <at> Given("my balance is $balance")
    public void my_balance_is(int balance){

    <at> When("I withdraw $value")
    public void I_withdraw(int value){

    <at> Then("my bank account balance should be $balance")
    <at> Alias("my bank account balance should be <balance>")
    public void my_bank_account_balance_should_be( <at> Named("balance")int balance){

        Assert.assertEquals(balance, ba.getBalance());

    <at> When("I add $value")
    <at> Alias("I add <value>")
    public void I_add( <at> Named("value")int value) {

    <at> Given("these people have bank accounts with balances: $accountInfos")
    public void these_people_have_bank_accounts_with_balances( <at> Named("accountInfos")ExamplesTable accountInfos) throws Throwable {
        for(Map<String, String> ai : accountInfos.getRows()) {
            final BankAccount b = new BankAccount(ai.get("Name"));
            final int balance = Integer.parseInt(ai.get("balance"));

    <at> When("I take all their money")
    public void I_take_all_their_money() {
        for(BankAccount bankAccount : accounts) {

    public static class BankAccount {
        private int balance;
        private final String name;

        public BankAccount(String name) {
   = name;

        public int getBalance() {
            return this.balance;
        public void setBalance(int balance) {
            this.balance = balance;

        public void add(int v) {
            this.balance += v;

        public void withdraw(int v) {
            this.balance -= v;

The second scenario (and only this one) is reusing the ba variable from the first scenario (i.e. it's not running the Lifecycle > Before).
Is this a bug or a feature?

Bernardo Oliveira Pinto
Byclosure, Lda.
Mauro Talevi | 24 Feb 13:39 2014

Re: SeleniumStepMonitor does not show up in JBehave 4.0 beta 4

Yes, it does not work yet in 4.0 beta because the step monitor is also used internally for finding matched steps.  I'll get a new beta out this week that uses a delegating model.

On 24 Feb 2014, at 08:52, Hans Schwäbli < <at>> wrote:

The new ContextStepMonitor works with jbehave 3.9 I discovered now, but not with 4.0-beta-4, at least not with the same code.
Maybe it is just because version 4 is still beta, or it has to be used in another way than in 3.9. I suppose there will be an example project for 4.0, so that I then can see how to use it for that version when it is released.
I will use jbehave 3.9 until then.

2014-02-24 9:44 GMT+01:00 Hans Schwäbli <>:
I could run that CoreStories, but could not port the example to version jbehave-beta-4.
The CoreStories example runs on version 3.10-SNAPSHOT which I cannot depend in Maven since it is not in the Maven repository.
Maybe CoreStories works only for 3.10-SNAPSHOT?
I have to figure this out. It is not so easy with stuggling with Maven and Java code at the same time to get it working.

2014-02-20 18:53 GMT+01:00 Mauro Talevi <>:

CoreStories has a working example.

On 20 Feb 2014, at 16:56, Hans Schwäbli <> wrote:

Yes, I want to show the running progress like I could do with SeleniumStepMonitor.
I try to figure out how to use that new way.

2014-02-20 1:07 GMT+01:00 Mauro Talevi <>:
The SeleniumStepMonitor should be replaced by the ContextStepMonitor, now in core.

What is the objective?   Show the running progress?

On 19/02/2014 16:34, Hans Schwäbli wrote:
I am opening a new topic for the problem with the SeleniumStepMonitor in JBehave 4.0 beta 4 with JBehave-web 3.5.5 and 3.6-beta-1.
It does not show up with that version. It works however with JBehave 3.9.
I discovered that in method org.jbehave.core.embedder.PerformableTree.RunContext.scenarioSteps(Scenario, Map<String, String>) a MatchingStepMonitor is used instead of the configured step monitor.
It can be fixed by creating an anonymous class and overriding org.jbehave.core.steps.MarkUnmatchedStepsAsPending.collectScenarioSteps(List<CandidateSteps>, Scenario, Map<String, String>, StepMonitor)
            MarkUnmatchedStepsAsPending myStepCollector = new MarkUnmatchedStepsAsPending() {
                <at> Override
                public List<Step> collectScenarioSteps(List<CandidateSteps> candidateSteps, Scenario scenario, Map<String, String> parameters,
                        StepMonitor stepMonitor) {
                    return super.collectScenarioSteps(candidateSteps, scenario, parameters, mySeleniumStepMonitor);
Then in the configuration I write: .useStepCollector(myStepCollector)
It must be an older issue since month ago I had the same problem with JBehave 4.0 beta 3 and switched to version 3.9 because of that.
Maybe it is a bug (or you can please tell me how to configure it properly for JBehave 4.x)?

Johnny Wong | 21 Feb 11:07 2014

How to run JBehave tests in Maven via CLI?

Hello there --

I am new to JBehave and Maven and am struggling to properly run my JBehave tests. From the command line, which is the proper command:

mvn integration-test


mvn jbehave:run-stories-as-embeddables

When I run the Etsy tutorial example with "mvn integration-test", it shows 'BUILD SUCCESS' even though there are 2 stories (Etsy Cart and Etsy Browse) that throw Exceptions. The JBehave HTML report shows the errors, but they are not shown in the console (ie., the BUILD SUCCESS I already mentioned). I am also going to integrate with Jenkins, so I need it to also report it on the console (or not?)

Anyhow, How can I properly run JBehave tests with Maven on the CLI so that it fails (but does not stop) when any of the tests fails and reports so on the CLI?



Johnny Wong
Director de Desarrollo, Advertising & MercadoShops

+54 (9) 11 33585162 | +1 415 670 9664 | Skype: wongjoh