#1. install with zef

Behave is distributed through Raku's package manager, zef. Don't have Raku yet? Grab it from rakudo.org. zef ships with every install.

$ zef install BDD::Behave

That installs the BDD::Behave module and puts the behave CLI on your PATH. Verify:

$ behave --version
BDD::Behave 0.0.4

#2. write your first spec

Create a specs/ directory next to your lib/, and drop a file named anything ending in spec.raku:

use BDD::Behave;

describe 'String#flip', {
  it 'reverses the characters', {
    expect('hello'.flip).to.be('olleh');
  }

  it 'is its own inverse', {
    expect('hello'.flip.flip).to.be('hello');
  }
}

#3. run it

Point behave at a file, a directory, or run it with no arguments. It will automatically look for a specs/ directory and run anything matching spec.raku.

behave
.. 2 examples, 0 failed, 2 passed

That's the progress formatter's default output. Try a different one:

behave --format tree
⮑ 'String#flip' ⮑ 'reverses the characters' ⮑ SUCCESS ⮑ 'is its own inverse' ⮑ SUCCESS 2 examples, 0 failed, 2 passed

#useful flags

FlagWhat it does
--format NAMEPick an output formatter: tree, progress, documentation, html, json, junit, tap.
--tag NAMERun only examples tagged NAME. Use ~NAME to exclude.
--example REGEXFilter examples by description regex.
--seed NFix the example-order random seed for reproducible runs.
--fail-fastStop on the first failure.
--profilePrint the "top N slowest" report at the end.
--slow-threshold SMark any example over S seconds inline.
--memory-profilePrint per-example RSS deltas. Pair with --memory-threshold.
--coverageRecord line coverage. Pair with --coverage-dir lib.
--benchmarkRun benchmark blocks and print the summary.
--helpThe full list, with descriptions.

#continuous integration

For CI dashboards, pick a machine-readable formatter and pipe the output where your runner expects it.

- name: Run specs
  run: behave --format junit specs/ > junit.xml

- name: Upload test results
  if: always()
  uses: actions/upload-artifact@v4
  with:
    name: junit
    path: junit.xml
# JSON for custom dashboards
behave --format json specs/ > report.json

# TAP for prove / tappy consumers
behave --format tap specs/ | tappy

# HTML report you can open locally
behave --format html specs/ > report.html && open report.html

#where to go next