{"id":15174190,"url":"https://github.com/lewismj/cucumber","last_synced_at":"2025-10-26T07:31:23.171Z","repository":{"id":57729535,"uuid":"49347491","full_name":"lewismj/cucumber","owner":"lewismj","description":"Cucumber Test Framework  \u0026 Plugin for SBT (BDD Testing in Scala)","archived":false,"fork":false,"pushed_at":"2019-12-10T21:12:48.000Z","size":181,"stargazers_count":41,"open_issues_count":8,"forks_count":18,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-31T16:53:37.339Z","etag":null,"topics":["bdd","bdd-tests","cucumber","cucumber-plugin","cucumber-runner","cucumber-test-framework","cucumber-tests","jvm","plugin","sbt","scala","test-framework","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lewismj.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-01-10T00:37:02.000Z","updated_at":"2024-03-08T16:38:03.000Z","dependencies_parsed_at":"2022-09-11T07:51:27.076Z","dependency_job_id":null,"html_url":"https://github.com/lewismj/cucumber","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewismj%2Fcucumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewismj%2Fcucumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewismj%2Fcucumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewismj%2Fcucumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lewismj","download_url":"https://codeload.github.com/lewismj/cucumber/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238284883,"owners_count":19446747,"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":["bdd","bdd-tests","cucumber","cucumber-plugin","cucumber-runner","cucumber-test-framework","cucumber-tests","jvm","plugin","sbt","scala","test-framework","unit-testing"],"created_at":"2024-09-27T11:40:40.696Z","updated_at":"2025-10-26T07:31:22.746Z","avatar_url":"https://github.com/lewismj.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cucumber Test Framework \u0026 Plugin for SBT\n\u003cp align=\"left\"\u003e\n\u003ca href=\"https://travis-ci.org/lewismj/cucumber\"\u003e\n\u003cimg src=\"https://travis-ci.org/lewismj/cucumber.svg?branch=master\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22cucumber-runner_2.12%22\"\u003e\n\u003cimg src=\"https://maven-badges.herokuapp.com/maven-central/com.waioeka.sbt/cucumber-runner_2.12/badge.svg\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22cucumber-plugin%22\"\u003e\n\u003cimg src=\"https://maven-badges.herokuapp.com/maven-central/com.waioeka.sbt/cucumber-plugin/badge.svg\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://waffle.io/lewismj/cucumber\"\u003e\n\u003cimg src=\"https://badge.waffle.io/lewismj/cucumber.svg?columns=In%20Progress,Done\u0026style=flat-square\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://gitter.im/lewismj/cucumber\"\u003e\n\u003cimg src=\"https://badges.gitter.im/Join%20Chat.svg\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n## Update Notes \n\n\n1. The runner (0.2.0) now supports running test suites in parallel.\n\n    * The existing method of running everything serially and producing a consolidated report is still supported.\n    \n    * A new method of defining suites that can run in parallel is introduced.\n    \n    Described below, project examples of both approaches are [here](https://github.com/lewismj/cucumber/tree/master/examples).\n\n2. The plugin has moved and is now available within the [sbt github](https://github.com/sbt/sbt-cucumber).\n\n## Summary\n\nThis project contains a Cucumber test framework for sbt. There is also a plugin that provides a new sbt command.\n\n1. **_Cucumber Test Framework_**  An sbt test framework, the _runner_, runs Cucumber tests as part of a unit test run (i.e. `sbt test`).\n\n2.  An **SBT [plugin](plugin.md)** that provides a new command `sbt cucumber`. It allows you to run Cucumber tests independently of unit tests.\n  \n\nUnless you have a specific requirement to run Cucumber tests outside of unit test framework, use the test framework\nrather than the plugin.\n\nThe plugin can be used if you want a separate command to run Cucumber tests and have your normal test framework\nignore Cucumber tests. If you want to use the plugin, there is more information [here](plugin.md).\n\n__The Cucumber test framework does not depend on the plugin__.\n\n## Dependency Information\n\n```scala\nlibraryDependencies += \"com.waioeka.sbt\" %% \"cucumber-runner\" % \"0.2.0\"\n```\n\n## Contact\n\nMichael Lewis: lewismj@mac.com\n\n\n## Cucumber Test Framework\n\nYou can run tests two ways:\n\n1. Run tests in parallel. Each test suite must mixin `CucumberTestSuite` and \n   overload two methods, that tell the suite which are the corresponding features to run\n   and which sub-directory of the plugin output to put the results.\n\n2. Sequentially, this runs all Cucumber tests serially and produces a consolidated output,\n   i.e. a single html or json (choose the plugin(s) in your build.sbt file.)\n\n\n## 1. Running tests in parallel.\n\nDefine a suite that supports a number of features, for example,\n\n```scala\nclass AddAndMultiplySteps extends ScalaDsl with EN with Matchers with CucumberTestSuite  {\n  override def features = List(\"Multiplication.feature\",\"Addition.feature\")\n  override def path = \"addAndMult\" // this is the output path, appended to plugin path.\n\n  var x : Int = 0\n  var y : Int = 0\n  var z : Int = 0\n\n  Given(\"\"\"^a variable x with value (\\d+)$\"\"\") { (arg0: Int) =\u003e\n    x = arg0\n  }\n\n  Given(\"\"\"^a variable y with value (\\d+)$\"\"\") { (arg0: Int) =\u003e\n    y = arg0\n  }\n\n  When(\"\"\"^I multiply x \\* y$\"\"\") { () =\u003e\n    z = x * y\n  }\n\n  When(\"\"\"^I add x \\+ y$\"\"\"){ () =\u003e\n    z = x + y\n  }\n\n   Then(\"\"\"^I get (\\d+)$\"\"\") { (arg0: Int) =\u003e\n     z should be (arg0)\n   }\n}\n```\n\nIn your build.sbt switch on the parallel output:\n\n```scala\nval framework = new TestFramework(\"com.waioeka.sbt.runner.CucumberFramework\")\ntestFrameworks += framework\n\n// Configure the arguments.\ntestOptions in Test += Tests.Argument(framework,\"--glue\",\"\")\ntestOptions in Test += Tests.Argument(framework,\"--plugin\",\"html:/tmp/html\")\ntestOptions in Test += Tests.Argument(framework,\"--plugin\",\"json:/tmp/json\")\n\n/** can remove pretty printing if running in parallel. */\nparallelExecution in Test := true\n```\n\nAt present, the output for each suite will be a sub-directory of the plugin output.\n\n\n## 2. Running all the features serially to produce a consolidated test report.\n\n\nIn your test project define an empty class that inherits from `Cucumber Spec`\n\n```scala\nclass Spec extends CucumberSpec\n```\n\nAdd the following properties to `build.sbt`:\n\n```scala\nval framework = new TestFramework(\"com.waioeka.sbt.runner.CucumberFramework\")\ntestFrameworks += framework\n\n// Configure the arguments.\ntestOptions in Test += Tests.Argument(framework,\"--glue\",\"\")\ntestOptions in Test += Tests.Argument(framework,\"--plugin\",\"pretty\")\ntestOptions in Test += Tests.Argument(framework,\"--plugin\",\"html:/tmp/html\")\ntestOptions in Test += Tests.Argument(framework,\"--plugin\",\"json:/tmp/json\")\nparallelExecution in Test := false \n```\n\nThe framework will expect feature files in the `test/resources` directory. If your feature files are stored elsewhere, add that location to the 'unmanagedClasspath', e.g.\n\n```scala\nunmanagedClasspath in Test += baseDirectory.value / \"src/test/features\"\n```\n\n\n### Example\n\nThe project _example_ illustrates how to setup and use the _runner_. To integrate BDD testing into your unit test framework.\nAs shown below, using the runner and plugin, you can now run `sbt test`.\n\n```scala\npackage com.waioeka.sbt\n\nimport com.waioeka.sbt.runner.CucumberSpec\nimport cucumber.api.scala.{ScalaDsl, EN}\nimport org.scalatest.Matchers\n\nclass CucumberTestSuite extends CucumberSpec\n\n\n/** AddAndMultiplySteps*/\nclass MultiplicationSteps extends ScalaDsl with EN with Matchers  {\n  var x : Int = 0\n  var y : Int = 0\n  var z : Int = 0\n\n  Given(\"\"\"^a variable x with value (\\d+)$\"\"\") { (arg0: Int) =\u003e\n    x = arg0\n  }\n\n  Given(\"\"\"^a variable y with value (\\d+)$\"\"\") { (arg0: Int) =\u003e\n    y = arg0\n  }\n\n  When(\"\"\"^I multiply x \\* y$\"\"\") { () =\u003e\n    z = x * y\n  }\n\n Then(\"\"\"^I get (\\d+)$\"\"\") { (arg0: Int) =\u003e\n   z should be (arg0)\n }\n}\n```\n\n\n```\n\u003e test\n[info] ExampleSpec:\n[info] - An empty Set should have size 0\n@my-test\nFeature: Multiplication\n  In order to avoid making mistakes\n  As a dummy\n  I want to multiply numbers\n\n  Scenario: Multiply two variables  # Multiplication.feature:7\n    Given a variable x with value 2 # MultiplicationSteps.scala:44\n    And a variable y with value 3   # MultiplicationSteps.scala:48\n    When I multiply x * y           # MultiplicationSteps.scala:52\n    Then I get 6                    # MultiplicationSteps.scala:56\n\n1 Scenarios (1 passed)\n4 Steps (4 passed)\n0m0.081s\n\n\n1 Scenarios (1 passed)\n4 Steps (4 passed)\n0m0.081s\n\n[info] CucumberTestSuite .. passed\n[info] ScalaTest\n[info] Run completed in 422 milliseconds.\n[info] Total number of tests run: 1\n[info] Suites: completed 1, aborted 0\n[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0\n[info] All tests passed.\n[info] CucumberTest\n[info] Tests: succeeded 1, failed 0\n[info] Passed: Total 2, Failed 0, Errors 0, Passed 2\n[success] Total time: 1 s, completed 02-Apr-2017 23:16:53\n\u003e\n```\n\n[1]:\thttps://waffle.io/lewismj/cucumber\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flewismj%2Fcucumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flewismj%2Fcucumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flewismj%2Fcucumber/lists"}