BDD is an acronym for Behaviour Driven Development. It is a process for creating and verifying requirements, written in such a way that they can be executed as code. This package aims to be a tool for executing such requirements, and creating reports.
See docs/USAGE.md for more detailed usage.
See docs/TUTORIAL.md for a step-by-step introduction to this package.
Specifications are written in the Gherkin format, such as
Feature: Making coffee Scenario: Making a cup of coffee Given that there is a cup in the coffee machine When the "Coffee" button is pressed Then the cup is filled with coffee
Then line, a corresponding method is written, which is executed when
that line is reached.
using Behavior using CoffeeMachine hascoffee(cup::Cup) = cup[:coffee] > 0.0 @given("that there is a cup in the coffee machine") do context cup = Cup() machine = Machine() cupisinthemachine(machine, cup) context[:cup] = cup context[:machine] = machine end @when("the \"Coffee\" button is pressed") do context machine = context[:machine] coffeewaspressed(machine) end @then("the cup is filled with coffee") do context cup = context[:cup] @expect hascoffee(cup) end
Feature files have extension
.feature, and are stored in the
features directory (see
"Current state" for current limitations), and step definitions (the executable code) have the
.jl and are stored in
The project CoffeeMachine.jl is an example of how to use Behavior.jl.
Run the command line tool
runspec.jl from the directory containing the
features directory, or
from the Julia REPL with
julia> using Behavior julia> runspec()
See "Current state" for limitations.
The package is not feature complete, but is absolutely in a usable state. It is also under active development.
These are some current limitations and missing features, that will be lifted as development progresses:
- Currently does not function in Julia 1.4 and probably not before
- Presenting the results of scenarios is very rudimentary.
- Step definition variables do not yet have type information.
- Gherkin Rules support
- Reads feature files from anywhere under
- Reads step files from anywhere under
- Variables in step definition strings.
Behavior.jl is licensed under the Apache License version 2.0.