This is an announcement of Behavior.jl, a tool for Behavior Driven Development (BDD) in Julia.
It is similar to tools like Pythons Behave, or the canonical BDD tool Cucumber.
This package was previously known as ExecutableSpecifications.jl before Julia 1.0, but is now re-introduced as Behavior.jl.
This package allows you to write specifications in the Gherkin format, like this
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
and executing this specification as code using Julia
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
These tests can then be executed as part of the
runtests.jl test file, like unit tests using the
The package is in a usable state, but is under continuous development, so things are likely to break between some versions.
Link to GitHub