Configuring Steps in the Web Runner

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

The Web Runner is a Wicket-based application and provides a base application class, WebRunnerApplication which only requires the specification of the InjectableStepsFactory for the story running, e.g.:

The user can optionaly override any of the protected methods of WebRunnerApplication which return instances of the configurable components of the Web Runner.

The application class name then needs to be configured in the WicketFilter in your web.xml:

Note that some webapp containers may not handle filters properly. In this case, you can equally use a servlet to configure the Wicket application:

JBehave Web Runner wicket org.apache.wicket.protocol.http.WicketServlet applicationClassName org.jbehave.web.examples.trader.runner.TraderRunnerApplication configuration deployment wicket /* ]]>

Running with Maven

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

Running with Ant

Ant users can download the web distribution from download page

  • Unzip it to a local directory
  • Add a jar containing your Steps and Wicket application instances to lib/ directory
  • Edit webapp/WEB-INF/web.xml to configure the Application class name that you've defined, replacing the org.jbehave.web.runner.wicket.WebRunnerApplication class name with your fully-qualified Application class name. See TraderRunnerApplication 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 stories.
  • 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.