Registering your Steps in the Web Runner

The Web Runner is a webapp that allows users to run any generic textual scenario. In order to do this, the appropriate JBehave Steps instances required to match the textual steps need to be registered with the application.

Maven users can model their own module on the trader web example

Ant users can download the web distribution from download page

  • Unzip it to a local directory
  • Add a jar containing your Steps and Registrar instances to lib/ directory
  • Edit webapp/WEB-INF/web.xml to configure the Registrar class name that you've defined, replacing the org.jbehave.web.runner.waffle.JBehaveRegistrar class name with your fully-qualified Registrar class name. See TraderRegistrar for an example of how easy it is. The minimal requirement is to specify the one or more instances of Steps that you need to run the scenarios.
  • In bin/ dir execute: ant -f deploy.xml deploy:webapp, which will deploy a new jbehave-web.war to your local Jetty installation (provided you have $JETTY_HOME defined). You can configure your own deploy dir via the deploy.properties file or simply copy the war created in the target/ dir to your favourite webapp container.

Customising the Web Runner resources

The Web Runner comes with default web resources, but these can be overridden by adding them to the src/main/webapp directory. Only custom resources that override the default ones are required. So, e.g. to change the default style, only src/main/webapp/style/jbehave/jbehave.css needs to be added. Similary, to change home page template, only src/main/webapp/ftl/home.ftl is needed. If any of these are removed the defaults will apply.