What is BDD?

  • BDD stands for Behaviour-Driven Development and you can learn more about BBD from our Introduction.

    What Java version is required by JBehave 2.x?

  • JBehave 2.x uses Java 5 annotations, so any JDK 1.5+ will work.

    How do I use JBehave within my development environment?

  • Scenarios can be run in IDE. More info
  • Scenarios can be run in command-line. More info
  • Scenarios can be run via the Web Runner interface. More info

    What are the libraries that JBehave 2.x depends on?

  • Refer to the JBehave dependencies page

    Eclipse can’t seem to find annotations if they are contained within a jar

  • Some versions of Eclipse need to be aware of the JBehave source to enable the JUnit plugin for scenarios, as they can’t spot the @Test annotation in a class jar. The link to the core sources is available from the download page.
  • Alternatively, Maven users can add the sources automatically to the build path.
  • A workaround is to override the runScenario() method annotated with @Test
    public class YourScenario extends JUnitScenario {
     
        @Test
        public void runScenario() throws Throwable {
            super.runScenario();
        }
     
    }

    Note that this is only required for the root scenario of all your scenarios.

    Can I run my scenarios in IDE with TestNG?

  • Similarly to the proposed workaround above, you should be able to run with TestNG by simply annotating the runScenario() method in your root Scenario class with the TestNG @Test annotation.
    public class YourScenario extends JUnitScenario {
     
        @org.testng.annotations.Test 
        public void runScenario() throws Throwable {
            super.runScenario();
        }
     
    }

    Note that we don’t tend to use TestNG so this solution as not been tested. If you encounter any issues please let us know.

    How do I make my scenarios fail when steps are not matched and are shown as pending?

  • Configure the PendingErrorStrategy in Configuration:
    new Configuration(){
       public PendingErrorStrategy forPendingSteps() {
           return PendingErrorStrategy.FAILING;
       }
    }

    How do I output all my scenario steps – and not just when a scenario fails?

  • Configure the ScenarioReporter in Configuration:
    new Configuration(){
         public ScenarioReporter forReportingScenarios() {
              return new PrintStreamScenarioReporter();
        }
    }
  • Alternatively, you can use PropertyBasedConfiguration, setting system property “org.jbehave.outputall”.


Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word