Giter Site home page Giter Site logo

sarvex / cucumber-lua Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cucumber/cucumber-lua

0.0 2.0 0.0 26 KB

A cucumber wire protocol implementation for Lua step definitions

License: MIT License

Ruby 6.48% Makefile 0.70% Lua 51.57% Gherkin 41.25%

cucumber-lua's Introduction

Cucumber-Lua

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

Installation

  1. Install Lua 5.2

  2. Install cucumber-lua using luarocks:

luarocks build https://raw.github.com/cucumber/cucumber-lua/master/cucumber-lua-0.0-2.rockspec
  1. 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

cucumber-lua's People

Contributors

britzl avatar dependabot[bot] avatar joshski avatar sarvex avatar

Watchers

 avatar  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.