{"id":13712016,"url":"https://github.com/cucumber/cucumber-lua","last_synced_at":"2025-06-16T02:03:41.056Z","repository":{"id":3051399,"uuid":"4072967","full_name":"cucumber/cucumber-lua","owner":"cucumber","description":"A cucumber wire protocol implementation for Lua step definitions","archived":false,"fork":false,"pushed_at":"2022-12-23T08:16:54.000Z","size":49,"stargazers_count":30,"open_issues_count":0,"forks_count":13,"subscribers_count":99,"default_branch":"main","last_synced_at":"2025-06-12T08:25:49.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cucumber.png","metadata":{"funding":{"open_collective":"cucumber"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-19T07:56:26.000Z","updated_at":"2025-06-09T02:36:13.000Z","dependencies_parsed_at":"2023-01-13T12:15:30.485Z","dependency_job_id":null,"html_url":"https://github.com/cucumber/cucumber-lua","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cucumber/cucumber-lua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcucumber-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcucumber-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcucumber-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcucumber-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cucumber","download_url":"https://codeload.github.com/cucumber/cucumber-lua/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcucumber-lua/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259998143,"owners_count":22943758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T23:01:14.076Z","updated_at":"2025-06-16T02:03:41.013Z","avatar_url":"https://github.com/cucumber.png","language":"Lua","funding_links":["https://opencollective.com/cucumber"],"categories":["By Technology"],"sub_categories":["Lua"],"readme":"# Cucumber-Lua\n[![Build Status](https://travis-ci.org/cucumber/cucumber-lua.svg?branch=master)](https://travis-ci.org/cucumber/cucumber-lua)\n\nA [wire protocol](https://github.com/cucumber/cucumber-ruby-wire) server for [cucumber-ruby](http://github.com/cucumber/cucumber-ruby) that executes steps defined in [Lua](http://www.lua.org/)\n\n#### Installation\n\n1. Install Lua 5.2\n\n2. Install cucumber-lua using luarocks:\n\n```\nluarocks build https://raw.github.com/cucumber/cucumber-lua/master/cucumber-lua-0.0-2.rockspec\n```\n\n3. Install [Ruby]([url](https://www.ruby-lang.org/en/documentation/installation/)), [cucumber-ruby]([url](http://github.com/cucumber/cucumber-ruby)) and the [wire protocol gem]([url](https://github.com/cucumber/cucumber-ruby-wire)).\n\nCreate a `Gemfile`\n\n```\nsource 'https://rubygems.org'\n\ngem \"cucumber\"\ngem \"cucumber-wire\"\n```\n\nThen ask [Bundler]([url](https://bundler.io/)) to install the gems:\n\n    bundle install\n    \nAdd a file to load the wire protocol plugin:\n\n    echo \"require 'cucumber/wire'\" \u003e features/support/wire.rb\n\n5. Add a .wire file telling cucumber that Lua is listening:\n\n###### /features/step_definitions/cucumber-lua.wire\n\n```\nhost: 0.0.0.0\nport: 9666\n```\n\n#### Usage\n\nRun the cucumber-lua server:\n\n```\ncucumber-lua\n```\n\nThen run cucumber in another terminal:\n\n```\nbundle exec cucumber\n```\n\n#### Lua Step Definitions\n\ncucumber-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).\n\nCreate your step definitions using the following global keywords:\n\n* `Before(fn)` - called before each scenario\n* `After(fn)` - called after each scenario\n* `Given(step, fn)` - define a step where a pre-condition/state is declared\n* `When(step, fn)` - define a step where user action or behaviour is performed\n* `Then(step, fn)` - define a step where the outcome is observed\n* `Pending(message)` - indicate a step as pending implementation\n\nNote: If a `Before` or `After` function fails the whole scenario is reported as failed.\n\n###### /features/step_definitions/steps.lua\n\n```Lua\nCalculator = require(\"calculator\")\n\nBefore(function()\n    Calculator:Reset()\nend)\n\nAfter(function()\n    print(\"I am called after each scenario\")\nend)\n\nGiven(\"I have entered (%d+) into the calculator\", function (number)\n    Calculator:Enter(number)\nend)\n\nWhen(\"I press add\", function ()\n    Calculator:Add()\nend)\n\nThen(\"the result should be (%d+) on the screen\", function (number)\n    assert(Calculator.result == tonumber(number),\n           \"Expected \" .. number .. \", was \" .. Calculator.result)\nend)\n\nThen(\"Something not yet implemented\", function ()\n    Pending(\"It's not ready yet\")\nend)\n```\n\n#### Running the Cucumber-Lua specs\n\n```\nlua spec/runner.lua\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcucumber%2Fcucumber-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcucumber%2Fcucumber-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcucumber%2Fcucumber-lua/lists"}