Coder Social home page Coder Social logo

executablespecifications.jl's Introduction

ExecutableSpecifications

Build Status codecov.io

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.

This package is in the early stages of development, and has only minimal functionality.

Usage

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

For each Given, When, and Then line, a corresponding method is written, which is executed when that line is reached.

using ExecutableSpecifications
using CoffeeMachine

hascoffee(cup::Cup) = cup[:coffee] > 0.0

@given "that there is a cup in the coffee machine" begin
    cup = Cup()
    machine = Machine()

    cupisinthemachine(machine, cup)

    context[:cup] = cup
    context[:machine] = machine
end

@when "the \"Coffee\" button is pressed" begin
    machine = context[:machine]
    coffeewaspressed(machine)
end

@then "the cup is filled with coffee" begin
    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 extension .jl and are stored in features/steps.

Example project

The project CoffeeMachine.jl is an example of how to use ExecutableSpecifications.jl.

Running

Run the command line tool runspec.jl from the directory containing the features directory, or from the Julia REPL with

julia> using ExecutableSpecifications
julia> runspec()

See "Current state" for limitations.

Migration to 0.7

Then plan is to do the migration to Julia 0.7 in the migration-0.7 branch. Once 0.7 is released, this branch will be merged to master, and updates to the 0.6 version of the code will only be made upon request.

Essentially this package will move to 0.7 as soon as possible, which is feasible because it presumably is not used widely (or at all) yet.

Current state

The package has minimal functionality, but is under active development.

These are some current limitations, that will be lifted as development progresses:

  • Reads feature and step definition files from a single hardcoded directory.

    Today only the directory features is searched for feature files. Step files are only read from features/steps/*.jl. Going forward, all feature files and all step files will be read of course.

  • Presenting the results of scenarios is very rudimentary.

  • No setup or teardown functions.

  • No variables in step definition strings

    One would like to be able to define a variable in a step definition like @given "some value {foo}" begin. Without this, scenario outlines may become difficult to use, since you have to define a separate step definition for each value used in the outline.

License

ExecutableSpecifications.jl is licensed under the Apache License version 2.0.

executablespecifications.jl's People

Contributors

erikedin avatar taqtiqa-admin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.