Ant Tasks

JBehave supports accessing the Embedder functionality via Ant tasks:

Ant tasks support the following properties:

  • sourceDirectory: defaults to src/main/java
  • testSourceDirectory: defaults to src/test/java
  • outputDirectory: defaults to target/classes
  • testOutputDirectory: defaults to target/test-classes
  • scope: [compile|test], defaults to compile
  • includes: CSV of include patterns
  • excludes: CSV of exclude patterns
  • metaFilters: CSV of meta filters
  • systemProperties: CSV of system properties to set during execution
  • batch: [true|false], defaults to false
  • skip: [true|false], defaults to false
  • ignoreFailureInStories: [true|false], defaults to false
  • ignoreFailureInView: [true|false], defaults to false
  • generateViewAfterStories: [true|false], defaults to true
  • storyTimeoutInSecs: defaults to 300
  • storyTimeoutInSecsByPath: defaults to 300 (the default of storyTimeoutInSecs)
    • Overrides the default value in storyTimeoutInSecs, and can be expressed as a CSV of regex
      expressions matching story paths. E.g. "*/long/.story:5000,*/short/.story:200,*/medium/m_story.story:1000"
  • failOnStoryTimeout: [true|false], defaults to false
  • threads: defaults to 1
  • embedderClass: defaults to Embedder.
  • injectableEmbedderClass: defaults to null
  • storyFinderClass: defaults to StoryFinder
Performance Testing: You can make use of storyTimeoutInSecs and storyTimeoutInSecsByPath to ensure tests run under the time(s) specified

An example of a typical Ant task usage is:

Remember to include jbehave-ant to your runtime classpath.

The default scope is compile, which means that the stories will be looked up in the source directory (which defaults to src/main/java by can be overridden). If the scope is set to test the stories will be looked up in the test source directory (which defaults to src/test/java but can be overridden).