Story Timeouts

Story execution often requires stories to time out after a given duration. The story timeouts are configurable via the EmbedderControls, or equivalently via @UsingEmbedder or the Maven goals.

Multiple timeout formats

JBehave supports multiple timeout formats:

  • Simple format: 1d 12h 30m 15s. Any of the units can be omitted.
  • Digits format: only specifying digits will be understood as being expressed in seconds

The format parsing will be attempted in the given order. If no valid format is found, the parsing will fail with a runtime TimeoutFormatException.

Custom timeout parsers

Custom timeout parsers can be provided by implementing the TimeoutParser interface and configuring it via the Embedder useTimeoutParsers method.

User-provided parsers will take precedence over the default parsers.

Specification by path

Timeouts can be configured to be applicable only for a specific groups of path patterns. The story timeouts property is a comma-separated list of colon-separated pattern-timeout pairs:


The path pattern is optional and if not specified it is assumed to be a default timeout used when other paths are not matched. The first such default timeout found in the list will be used.

The path patterns can be either Ant-style or regular expression patterns. Valid examples of story timeouts include:

    2m 30s
    2m 30s,**/*short*:50s,**/*long*:5m