JBehave is designed to be embedded in different development environments. The JBehave Core module contains support for running stories as JUnit tests - which can be run either in your favourite IDE or in your command-line build that supports JUnit tests. Other unit testing frameworks, e.g. TestNG or Spring Test, can also be used very easily, c.f. FAQ.
Stories can be run in different modes:
The Embedder can also be used to run the stories in any IDE environment, without the need to extend any base class. In the following example we use JUnit annotatation to denote different running instances:
where the TraderEmbedder/URLTraderEmbedder define the configuration using the loading from the classpath and URL resources, respectively. E.g.:
JBehave supports running both local and remote stories. To run remote stories, we need to use a URL-based loader with an appropriate remote code location. The difference w.r.t. the local run is minimal:
By default, the story runners are configured to fail-fast, i.e. the execution will stop at first failed story (but will complete execution of the all the scenarios in the story first). To allow the generation of a complete stories view (reporting how many stories failed), the runners need to be enabled to run stories with ignoreFailureInStories flag set to true. In this way, all stories will run and the failure will be assessed only during the view generation. If any stories failed, the build will fail correspondingly. Should the need to ignore failure in the view arise (although generally not recommended), one can set the ignoreFailureInView flag to true.