Skip to content

Running Specs

The behave command runs Behave specs.

Default behavior

With no arguments, behave looks for a specs/ directory under the current working directory and runs every file matching spec.raku (recursively).

1
$ behave

Selecting files

Pass one or more spec file paths to run a subset:

1
$ behave specs/users-spec.raku specs/admin-spec.raku

Local development

When you're working on Behave itself (or your project's lib/ is not yet installed), tell Raku where to find the modules:

1
2
$ raku -Ilib bin/behave
$ raku -Ilib bin/behave specs/some-spec.raku

Options

Option Effect
--help Display usage
--verbose Print each spec file as it is loaded
--tag NAME Run only examples tagged NAME (repeatable; OR semantics). See Tags.
--exclude-tag NAME Skip examples tagged NAME (repeatable).
--example PATTERN Run only examples whose full nested description matches PATTERN (substring; or /regex/). Repeatable; OR semantics.
-e PATTERN Alias for --example.

Filtering by description

--example PATTERN (alias -e) runs only examples whose full nested description matches PATTERN (substring or /regex/). See Example Filter for the full reference, including how it composes with --tag.

Output

Behave prints each describe/context with a marker, indenting nested groups, and reports SUCCESS / FAILURE / PENDING / SKIPPED per example. See Focus and Skip for xit / fit / xdescribe / fdescribe. After all specs run it prints a summary like:

1
2
3
============================================================
Overall: 96 examples
  96 passed

Exit code

behave exits 0 if every example passed, 1 if any example failed.