Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A cucumber wire protocol implementation for Lua step definitions

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 examples
Octocat-spinner-32 features
Octocat-spinner-32 spec
Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 cucumber-lua-0.0-1.rockspec
Octocat-spinner-32 server.lua
README.md

Cucumber-Lua

A wire protocol implementation for cucumber that executes steps defined in Lua

Installation

  1. Install Lua 5.1 (The Lua package management system, luarocks, is incompatible with Lua 5.2 at the time of writing)

  2. Install cucumber-lua using luarocks:

    luarocks build https://raw.github.com/cucumber/cucumber-lua/master/cucumber-lua-0.0-1.rockspec

  3. Add a .wire file telling cucumber that Lua is listening:

/features/step_definitions/cucumber-lua.wire
host: 0.0.0.0
port: 9666

Usage

Run the cucumber-lua server:

cucumber-lua

Then run cucumber in another terminal:

cucumber

Lua Step Definitions

cucumber-lua expects you to define a single file for step definitions (features/step_definitions/steps.lua). If you need anything more than a single file, use lua modules and require them from your main steps file (that means we don't need luafilesystem)

/features/step_definitions/steps.lua
Calculator = require("calculator")

Before(function()
    Calculator:Reset()
end)

Given("I have entered (%d+) into the calculator", function (number)
    Calculator:Enter(number)
end)

When("I press add", function ()
    Calculator:Add()
end)

Then("the result should be (%d+) on the screen", function (number)
    assert(Calculator.result == tonumber(number),
           "Expected " .. number .. ", was " .. Calculator.result)
end)

Then("Something not yet implemented", function ()
    Pending("It's not ready yet")
end)

Running the Cucumber-Lua specs

lua spec/runner.lua
Something went wrong with that request. Please try again.