{"id":38044059,"url":"https://github.com/regen-network/gocuke","last_synced_at":"2026-01-16T19:56:40.905Z","repository":{"id":38185327,"uuid":"467965277","full_name":"regen-network/gocuke","owner":"regen-network","description":"🥒 Gherkin-based BDD testing for go","archived":false,"fork":false,"pushed_at":"2024-09-10T16:50:58.000Z","size":137,"stargazers_count":22,"open_issues_count":8,"forks_count":9,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-11-18T20:24:42.799Z","etag":null,"topics":["bdd","cucumber","gherkin","go","golang","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/regen-network.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-09T14:39:44.000Z","updated_at":"2024-10-28T07:45:17.000Z","dependencies_parsed_at":"2023-02-09T14:16:28.646Z","dependency_job_id":"2c710681-a605-4ba0-ae13-2fe2d1f7633c","html_url":"https://github.com/regen-network/gocuke","commit_stats":{"total_commits":77,"total_committers":5,"mean_commits":15.4,"dds":"0.10389610389610393","last_synced_commit":"8921eaed4a6dc3104f000cb4636da0d927b6cc3b"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/regen-network/gocuke","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regen-network%2Fgocuke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regen-network%2Fgocuke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regen-network%2Fgocuke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regen-network%2Fgocuke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/regen-network","download_url":"https://codeload.github.com/regen-network/gocuke/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regen-network%2Fgocuke/sbom","scorecard":{"id":768797,"data":{"date":"2025-08-11","repo":{"name":"github.com/regen-network/gocuke","commit":"a4fc0d43515d03de3fa8c9d7460671a04c905037"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":6,"reason":"Found 19/30 approved changesets -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/regen-network/gocuke/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/regen-network/gocuke/go.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T01:39:11.519Z","repository_id":38185327,"created_at":"2025-08-23T01:39:11.520Z","updated_at":"2025-08-23T01:39:11.520Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28482141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","cucumber","gherkin","go","golang","testing"],"created_at":"2026-01-16T19:56:40.264Z","updated_at":"2026-01-16T19:56:40.887Z","avatar_url":"https://github.com/regen-network.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gocuke :cucumber:\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/regen-network/gocuke.svg)](https://pkg.go.dev/github.com/regen-network/gocuke)\n\n`gocuke` is a Gherkin-based BDD testing library for golang.\n\n## Features\n\n* tight integration with `*testing.T` (use any standard assertion library or mocking framework)\n* support for passing context between steps using suites which offers better\n  type safety than other generic context approaches\n* auto-discovery of step definitions defined as test suite methods and step\n  definition suggestions for minimal configuration\n* property-based testing via https://github.com/flyingmutant/rapid\n* user-friendly wrapper for data tables\n* support for big integers and big decimals (via https://github.com/cockroachdb/apd)\n* parallel test execution by default\n* full support for all of the latest Gherkin features including rules (via\n  the latest cucumber/gherkin-go and cucumber/messages-go)\n\n## Why another golang BDD library?\n\n`gocuke` was inspired by\n[godog](https://github.com/cucumber/godog) and [gobdd](https://github.com/go-bdd/gobdd).\nI tried both of these libraries and wanted a specific developer UX that\nI couldn't achieve with either. godog was not a good fit for the same reasons\nas that gobdd was created (specifically tight integration with `*testing.T`).\nLooking at the source code for gobdd, it needed to\nbe updated to a new versions of cucumber/gherkin-go and cucumber/messages-go\nand significant changes were needed to accommodate this API. So `gocuke` was\nwritten. We are happy to coordinate with the authors\nof either of these libraries at some point to align on common goals.\n\n## Quick Start\n\n### Step 1: Write some Gherkin\n\nIn a file `features/simple.feature`:\n\n```gherkin\nFeature: simple\n\n  Scenario Outline: eat cukes\n    Given I have \u003cx\u003e cukes\n    When I eat \u003cy\u003e\n    Then I have \u003cz\u003e left\n\n    Examples:\n      | x | y | z |\n      | 5 | 3 | 2 |\n      | 10 | 2 | 8 |\n```\n\n### Step 2: Setup the test suite\n\nIn a file simple_test.go:\n\n```go\npackage simple\n\nimport (\n\t\"github.com/regen-network/gocuke\"\n\t\"testing\"\n)\n\nfunc TestMinimal(t *testing.T) {\n\t// a new step definition suite is constructed for every scenario\n\tgocuke.NewRunner(t, \u0026suite{}).Run()\n}\n\ntype suite struct {\n\t// special arguments like TestingT are injected automatically into exported fields\n\tgocuke.TestingT\n}\n```\n\nWhen you run the tests, they should fail and suggest that you add these\nstep definitions:\n```go\nfunc (s *suite) IHaveCukes(a int64) {\n    panic(\"PENDING\")\n}\n\nfunc (s *suite) IEat(a int64) {\n    panic(\"PENDING\")\n}\n\nfunc (s *suite) IHaveLeft(a int64) {\n    panic(\"PENDING\")\n}\n\nSteps can be manually registered with the runner for customization using this code:\n  Step(`^I\\s+have\\s+(-?\\d+)\\s+cukes$`, (*suite).IHaveCukes).\n  Step(`^I\\s+eat\\s+(-?\\d+)$`, (*suite).IEat).\n  Step(`^I\\s+have\\s+(-?\\d+)\\s+left$`, (*suite).IHaveLeft)\n```\n\nCopy these definitions into `simple_test.go`.\n\n### Step 3: Implement Step Definitions\n\nNow implement the step definitions in `simple_test.go`, adding the\nvariable `cukes int64` to `suite` which tracks state between tests.\n\n**NOTE:** a new `suite` is constructed for every test case so it is safe\nto run tests in parallel, which is the default and what is happening\nin this example with each of the test cases in the `Scenario Outline`.\n\n```go\ntype suite struct {\n\tgocuke.TestingT\n\tcukes int64\n}\n\nfunc (s *suite) IHaveCukes(a int64) {\n\ts.cukes = a\n}\n\nfunc (s *suite) IEat(a int64) {\n\ts.cukes -= a\n}\n\nfunc (s *suite) IHaveLeft(a int64) {\n\tif a != s.cukes {\n\t\ts.Fatalf(\"expected %d cukes, have %d\", a, s.cukes)\n\t}\n}\n```\n\nYour tests should now pass!\n\n## Usage Details\n\n### Step Argument Types\n\n`gocuke` supports the following step argument types for arguments captured\nfrom steps:\n* `string`\n* `int64`\n* `*big.Int`\n* `*apd.Decimal`\n\n`float64` support is not planned because it is lossy.\n\n### Doc Strings and Data Tables\n\n`gocuke.DocString` or `gocuke.DataTable` should be used as the last argument\nin a step definition if the step uses a doc string or data table. `gocuke.DataTable`\nprovides useful helper methods for working with data tables.\n\n### Special Step Argument Types\n\nThe following special argument types are supported:\n* `gocuke.TestingT`\n* `gocuke.Scenario`\n* `gocuke.Step` (will be `nil` when used in a before hook or injected into a suite)\n* `*rapid.T` (see [Property-based testing using Rapid below](#property-based-testing-using-rapid))\n\nThese can be used in step definitions, hooks, and will be injected into the\nsuite type if there are exported fields defined with these types.\n\n### Hooks Methods\n\nIf the methods `Before`, `After`, `BeforeStep`, or `AfterStep` are defined\non the suite, they will be registered as hooks. `After`  will always be called\neven when tests fail. `AfterStep` will always be called whenever a step\nstarted and failed.\n\nIt is generally not recommended to over-use hooks. `Before` should primarily be\nused for setting up generic resources and `After` should be used for cleaning up\nresources. `Given` and `Background` steps should generally be used for setting\nup specific test conditions. `BeforeStep` and `AfterStep` should only be used\nin very special circumstances.\n\n### Tag Expressions\n\nCucumber [tag expressions](https://cucumber.io/docs/cucumber/api/#tag-expressions)\ncan be used for selecting a subset of tests to run. The command-line\noption `-gocuke.tags` can be used to specify a subset of tests to run.\n\nThe `Runner.Tags()` method can be used to select a set of tags to run in unit\ntests. `Runner.ShortTags` method can be used to select a set of tags to\n\n### Custom options\n\n`Runner` has the following methods for setting custom options\n\n* `Path()` sets custom paths, and accepts `**` glob patterns making use of the [doublestar](https://github.com/bmatcuk/doublestar/tree/master) library. The default is `features/**/*.feature`\n* `Step()` can be used to add custom steps with special regular expressions.\n* `Before()`, `After()`, `BeforeStep()`, or and `AfterStep()` can be used to register custom hooks.\n* `Tags` and `ShortTags` can be used with tag expressions as described above.\n* `NonParallel()` disables parallel tests.\n* `--verbose` or `-v` with `go test` will emit the current test step definition to stdout while your tests are running, this is useful for debugging failing tests.\n\n### Property-based testing using Rapid\n\nProperty-based tests using https://github.com/flyingmutant/rapid can be\nenabled by using `*rapid.T` as the first argument of test methods (after the\nsuite receiver argument). Property-based test cases will be run as many times\nis rapid is configured to run tests.\n\nExample:\n```gherkin\nScenario: any int64 value\n  Given any int64 string\n  When when I convert it to an int64\n  Then I get back the original value\n```\n\n```go\ntype suite struct {\n  TestingT\n\n  x, parsed   int64\n  str    string\n}\n\nfunc (s *valuesSuite) AnyInt64String(t *rapid.T) {\n\ts.x = rapid.Int64().Draw(t, \"x\").(int64)\n\ts.str = fmt.Sprintf(\"%d\", s.x)\n}\n\nfunc (s *valuesSuite) WhenIConvertItToAnInt64() {\n  s.parsed = toInt64(s, s.str)\n}\n\n\nfunc (s *suite) IGetBackTheOriginalValue() {\n  assert.Equal(s, s.x, s.parsed)\n}\n```\n## Roadmap\n\n* [Cucumber `message` based reporting](https://cucumber.io/docs/cucumber/reporting/)\n\n\n## Contributing\n\n### pre-commit hooks\n\n- We have some steps as defined in [.pre-commit-config.yaml] (.pre-commit-config.yaml) that run before commit\n  - On mac, simply `brew install pre-commit` to install the library\n  - To install the hooks for this repo `pre-commit install \u0026\u0026 pre-commit install --hook-type commit-msg`\n  - There's a helper script to install the hooks locally [setup-hooks.sh](setup-hooks.sh)\n  - pre-commit config is held in [.pre-commit-config.yaml](.pre-commit-config.yaml)\n  - More docs: \u003chttps://pre-commit.com/\u003e\n  - Standards Enforcement:\n    - Conventional Commits\n      - https://www.conventionalcommits.org/en/v1.0.0/\n      - prefix your commits with - fix:, feat:, BREAKING CHANGE:\n      - additionally- build:, chore:, ci:, docs:, style:, refactor:, perf:, test:\n    - misc file \u0026 convention linting\n    - golanglintci\n      - Runs various linting utilities\n      - https://github.com/golangci/golangci-lint\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregen-network%2Fgocuke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fregen-network%2Fgocuke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregen-network%2Fgocuke/lists"}