{"id":15174080,"url":"https://github.com/cucumber/split-java","last_synced_at":"2025-10-01T10:31:56.589Z","repository":{"id":39849054,"uuid":"426207113","full_name":"cucumber/split-java","owner":"cucumber","description":"A Cucumber plugin to toggle Split features from Cucumber scenarios","archived":true,"fork":false,"pushed_at":"2022-12-15T16:03:36.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":83,"default_branch":"main","last_synced_at":"2024-05-21T19:16:55.395Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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":"2021-11-09T11:44:14.000Z","updated_at":"2022-12-15T16:03:54.000Z","dependencies_parsed_at":"2023-01-29T03:45:54.526Z","dependency_job_id":null,"html_url":"https://github.com/cucumber/split-java","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fsplit-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fsplit-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fsplit-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fsplit-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cucumber","download_url":"https://codeload.github.com/cucumber/split-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":215667079,"owners_count":15913360,"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-09-27T11:24:05.140Z","updated_at":"2025-10-01T10:31:51.309Z","avatar_url":"https://github.com/cucumber.png","language":"Java","funding_links":["https://opencollective.com/cucumber"],"categories":[],"sub_categories":[],"readme":"[![test-java](https://github.com/cucumber/split-java/actions/workflows/test-java.yml/badge.svg)](https://github.com/cucumber/split-java/actions/workflows/test-java.yml)\n\n# Cucumber Split\n\nCucumber Split is a [Cucumber-JVM](https://github.com/cucumber/cucumber-jvm/#readme) plugin\nthat lets you toggle [Split](https://www.split.io/) feature flags on or off using [Cucumber tags](https://cucumber.io/docs/cucumber/api/#tags).\n\n## Motivation\n\nSoftware teams that use Split [feature flags](https://martinfowler.com/articles/feature-toggles.html)\nneed to test that the software works as expected for different combinations of feature flags.\n\nWith Cucumber Split you can toggle feature flags declaratively with tags, and then\nverify that the software works as expected.\n\n## Example\n\nImagine we're building firmware for a coffee machine, and that we can deploy the new firmware over the Internet\nwith continuous deployment.\n\nThe coffee machine is currently able to serve **espresso**, and **caffe latte**, and the team is currently working \non an experimental new feature to serve **flat white** as well.\n\nWe have decided to make the new **flat white** drink available to a small set of customers, so we have introduced a \nfeature flag to control whether it is available or not.\n\nEven though only a small set of customers will have the **flat white** functionality, we want to test that it works as\nexpected. We have two scenarios that verify options in the drink selection menu; One where **flat white** is not available\n(the feature flag is `off`), and another where it is (the feature flag is `on`):\n\n```gherkin\nFeature: Make Coffee\n\n  @split[flat-white:off]\n  Scenario: Display available drinks\n    Given the machine is not empty\n    Then the following drinks should be available:\n      | name          | price |\n      | espresso      |  1.90 |\n      | caffe latte   |  2.30 |\n\n  @split[flat-white:on]\n  Scenario: Display available drinks (including the new experimental flat white)\n    Given the machine is not empty\n    Then the following drinks should be available:\n      | name          | price |\n      | espresso      |  1.90 |\n      | flat white    |  2.10 |\n      | caffe latte   |  2.30 |\n```\n\n## Installation\n\nFirst, add Cucumber Split to your project:\n\n```xml\n\u003c!-- pom.xml --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.cucumber\u003c/groupId\u003e\n    \u003cartifactId\u003ecucumber-split\u003c/artifactId\u003e\n    \u003cversion\u003e0.0.2\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n```groovy\n// build.gradle(.kts)\ndependencies {\n  testImplementation 'io.cucumber:cucumber-split:0.0.2'\n}\n```\n\nNext, configure Cucumber to toggle Split features based on tags. Define a [before hook](https://cucumber.io/docs/cucumber/api/#hooks):\n\n```java\nimport io.cucumber.java.Before;\nimport io.cucumber.java.Scenario;\nimport io.cucumber.split.CucumberSplit;\nimport io.split.client.testing.SplitClientForTest;\n\npublic class StepDefinitions {\n    private final SplitClientForTest splitClient = new SplitClientForTest();\n\n    @Before\n    public void configureSplit(Scenario scenario) {\n        CucumberSplit.configureSplit(splitClient, scenario);\n    }\n}\n```\n\nThe `configureSplit` before hook will run before each scenario and configure the `splitClient` with feature flags declared\nas scenario tags.\n\n## Production code design\n\nYour production code must be designed in such a way that a `io.split.client.SplitClient` can be passed\nto it, rather than creating its own instance. This is so that we can pass it the `splitClient` instantiated and configured\nby Cucumber.\n\nOne way to achieve this is with the [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) pattern.\n\nIn the example, the `CoffeeMachine` class expects a `splitClient` to be passed via its constructor.\n\n## Default feature flags\n\nYou may have some flags that you want to set by default, only to override them in certain scenarios. One way to achieve this\nis via Cucumber's [tag inheritance](https://cucumber.io/docs/cucumber/api/#tags):\n\n```gherkin\n# Turn flat white off by default\n@split[flat-white:off]\nFeature: Make Coffee\n\n  Scenario: Display available drinks\n\n  # Override flat white to on just in this scenario\n  @split[flat-white:on]\n  Scenario: Display available drinks (including the new experimental flat white)\n```\n\n## Suggestions, questions or feedback\n\nPlease use the [issue tracker](/cucumber/split-java/issues) if you have suggestions, questions or feedback about this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcucumber%2Fsplit-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcucumber%2Fsplit-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcucumber%2Fsplit-java/lists"}