Contributing to Behave¶
This guide covers what you need to know to hack on Behave itself. If you're just using Behave for your own project, the Getting Started and Running Specs pages are what you want.
Test surfaces¶
Behave has two test surfaces, and a change is not considered done until both pass:
- Specs in
specs/— Behave's own behavioral test suite, written with thebehaveDSL and run by thebehaverunner. New features should land with specs that demonstrate the user-facing behavior. - Unit tests in
t/—Test-module tests that exercise individual classes (Runner, SpecTree, DSL helpers, etc.), run withprove6. Use these for tight, focused checks of internal invariants.
The two layers mirror each other folder-for-folder: every spec at specs/X/Y-spec.raku has a counterpart at t/X/Y.rakutest. Adding a new spec? Add the matching unit test in t/. Adding a new unit test? Add the matching spec.
Running the specs¶
1 | |
This loads every *spec.raku file under specs/ and runs them through the Behave runner.
Running the unit tests¶
1 | |
You can also run a single test file directly:
1 | |
Both at once¶
When developing Behave itself, run both before considering a change done:
1 | |
Coverage expectations¶
100% test coverage is the bar for new code. Both surfaces must cover the change:
- A new DSL function or runner option needs a spec demonstrating the user-facing behavior and unit tests pinning down the implementation details.
- A bug fix needs a regression spec and the matching unit test that would have caught the bug.
Documentation¶
Documentation lives in docs-src/:
- Per-feature pages live under
docs-src/docs/<topic>/<topic>.md, mirroring thespecs/folder layout. - After modifying anything under
docs-src/, rundocs-src/build.shto regenerate the published HTML indocs/. The build step is local; CI does not regenerate docs.
Continuous integration¶
Pushes and pull requests run the full suite via the GitHub Actions workflow. The same workflow publishes this documentation site to GitHub Pages on every push to main, serving the committed docs/ directory.