{"id":15270335,"url":"https://github.com/piotrfleury/pickled_cucumber","last_synced_at":"2026-02-07T19:08:41.999Z","repository":{"id":212663674,"uuid":"731987265","full_name":"PiotrFLEURY/pickled_cucumber","owner":"PiotrFLEURY","description":"A simple Cucumber test engine for Dart and Flutter","archived":false,"fork":false,"pushed_at":"2024-10-04T15:25:12.000Z","size":62,"stargazers_count":5,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-07T11:04:20.626Z","etag":null,"topics":["cucumber","dart","dartfrog","flutter","test-automation","testing","testing-tools"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/pickled_cucumber","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PiotrFLEURY.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-12-15T11:03:58.000Z","updated_at":"2024-10-31T07:37:15.000Z","dependencies_parsed_at":"2023-12-15T14:24:39.139Z","dependency_job_id":"6e25de02-d04f-4976-be4a-6b6558c73332","html_url":"https://github.com/PiotrFLEURY/pickled_cucumber","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"7938188f3904ac8e09b43b8ad63c3d8f6c10f48b"},"previous_names":["piotrfleury/cucumber_dart","piotrfleury/pickled_cucumber"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiotrFLEURY%2Fpickled_cucumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiotrFLEURY%2Fpickled_cucumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiotrFLEURY%2Fpickled_cucumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiotrFLEURY%2Fpickled_cucumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PiotrFLEURY","download_url":"https://codeload.github.com/PiotrFLEURY/pickled_cucumber/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223502361,"owners_count":17155938,"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":["cucumber","dart","dartfrog","flutter","test-automation","testing","testing-tools"],"created_at":"2024-09-30T07:08:20.269Z","updated_at":"2026-02-07T19:08:41.984Z","avatar_url":"https://github.com/PiotrFLEURY.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🥒 Pickled cucumber 🥒\n\nA simple Dart engine for Cucumber scenarios.\n\nWorks with **[🎯 Dart](#dart-usage)**, **[🐸 Dart Frog](#dart-frog-usage)** and **[🐦 Flutter](#flutter-usage)** projects.\n\n\u003e **ℹ️ Note:**\n\u003e\n\u003e This is a non official package, not affiliated with the Cucumber nor the Dart project.\n\u003e\n\u003e The goal of this project is to provide a simple way to run Cucumber scenarios in Dart and Flutter projects.\n\u003e\n\u003e This project does not aim to be a full Cucumber implementation. It only supports the most common features of Cucumber.\n\n## Table of contents\n\n- [🥒 Pickled cucumber 🎯](#-pickled-cucumber-)\n  - [Table of contents](#table-of-contents)\n  - [Getting started](#getting-started)\n  - [Usage](#usage)\n    - [🎯 Dart usage](#dart-usage)\n    - [🐸 Dart Frog usage](#dart-frog-usage)\n    - [🐦 Flutter usage](#flutter-usage)\n      - [Run your tests as Widget tests](#run-your-tests-as-widget-tests)\n      - [Run your tests as Integration tests](#run-your-tests-as-integration-tests)\n  - [Additional features](#additional-features)\n    - [Background Steps](#background-steps)\n  - [Links](#links)\n\n## Getting started\n\nAdd it to your `pubspec.yaml`:\n\n```bash\ndart pub add pickled_cucumber\n```\n\nor add it manually:\n\n```yaml\ndependencies:\n  pickled_cucumber: ^1.0.0 # use the latest version\n```\n\n## Usage\n\n### Dart usage\n\nWrite your first feature file in any directory\n\n```gherkin\n# features/counter.feature\n\nFeature: Counter\n\n  Scenario: Increment counter\n    Given a variable set to 1\n    When I increment the variable by 1\n    Then the variable should contain 2\n```\n\nCreate your Dart step definitions file\n\n```dart\n// features/step_definitions/counter_steps.dart\nclass CounterStepDefs {\n\n    int _counter;\n    \n    @Given(\"a variable set to {int}\")\n    void aVariableIsSetTo(int value) {\n        _counter = value;\n    }\n    \n    @When(\"I increment the variable by {int}\")\n    void iIncrementTheVariableBy(int value) {\n        _counter += value;\n    }\n\n    @Then(\"the variable should contain {int}\")\n    void theVariableShouldContain(int value) {\n        expect(_counter, value);\n    }\n}\n```\n\nCreate your entry point in `test` directory\n\n```dart\n// test/cucumber_test.dart\nimport 'package:pickled_cucumber/pickled_cucumber.dart';\nimport 'package:counter/features/step_definitions/counter_steps.dart';\n\nvoid main() {\n    final stepDefsDartFile = CounterStepDefs();\n\n    PickledCucumber.runFeatures(\n        \"features/counter.feature\",\n        stepDefsDartFile,\n    );\n}\n```\n\nRun your tests\n\n```bash\ndart test test/cucumber_test.dart\n```\n\n### Dart Frog usage\n\nPickled cucumber works the exact same way as Dart with Dart Frog.\n\nWrite your first feature file in any directory\n\n```gherkin\n# test/features/index.feature\nFeature: index\n\n    Scenario: GET index route\n        Given my app is running\n        When I visit the index route\n        Then I should see \"Welcome to Dart Frog!\"\n        And receive a 200 status code\n```\n\nCreate your Dart Frog step definitions file\n\n```dart\n// test/step_definitions.dart\nimport 'package:pickled_cucumber/pickled_cucumber.dart';\nimport 'package:dart_frog/dart_frog.dart';\nimport 'package:mocktail/mocktail.dart' as mocktail;\nimport 'package:test/test.dart';\nimport '../routes/index.dart' as route;\n\nclass MockRequestContext extends mocktail.Mock implements RequestContext {}\n\nclass DartFrogStepDefinition {\n  late MockRequestContext context;\n  Response? response;\n\n  @Given('my app is running')\n  void myAppIsRunning() {\n    context = MockRequestContext();\n  }\n\n  @When('I visit the index route')\n  void iVisitTheIndexRoute() {\n    response = route.onRequest(context);\n  }\n\n  @Then('I should see {string}')\n  Future\u003cvoid\u003e iShouldSee(String string) async {\n    expect(response!.body(), completion(equals(string)));\n  }\n\n  @And('receive a {int} status code')\n  void receiveStatusCode(int statusCode) {\n    expect(response!.statusCode, equals(statusCode));\n  }\n}\n\n```\n\nCreate your entry point in `test` directory\n\n```dart\n// test/cucumber_test.dart\nimport 'package:pickled_cucumber/pickled_cucumber.dart';\n\nimport 'step_definitions.dart';\n\nvoid main() {\n  PickledCucumber().runFeatures(\n    'test/features/',\n    DartFrogStepDefinition(),\n  );\n}\n\n```\n\n### Flutter usage\n\nWith Pickled cucumber, you can make [Flutter integration tests](https://docs.flutter.dev/cookbook/testing/integration/introduction) and [Widget tests](https://docs.flutter.dev/cookbook/testing/widget/introduction) using Cucumber scenarios.\n\nPickled cucumber works with code generation for Flutter projects.\n\nPlease add `build_runner` dependency to your project\n\n```bash\nflutter pub add dev:build_runner\n```\n\nWrite your first feature file in `test/features` directory\n\n```gherkin\n# test/features/counter.feature\n\nFeature: counter\n    counter should increment\n\n    Scenario: increment counter\n      Given counter is 0\n      When I increment counter\n      Then counter should be 1\n```\n\nCreate your Dart step definitions file in `test/` directory\n\n\u003e ⚠️ IMPORTANT: only import annotations ⚠️\n\n```dart\n// test/counter_steps.dart\n\n// IMPORTANT: ⚠️ only import annotations ⚠️\nimport 'package:pickled_cucumber/src/annotations.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter_example/main.dart';\nimport 'package:flutter_test/flutter_test.dart';\n\n@StepDefinition()\nclass CounterSteps {\n\n  @Given('counter is {int}')\n  Future\u003cvoid\u003e counterIs(WidgetTester tester, int counter) async {\n    debugPrint('counter is $counter');\n    await tester.pumpWidget(const MyApp());\n\n    expect(find.text('$counter'), findsOneWidget);\n  }\n\n  @When('I increment counter')\n  Future\u003cvoid\u003e iIncrementCounter(\n    WidgetTester tester,\n  ) async {\n    debugPrint('I increment counter');\n\n    await tester.tap(find.byIcon(Icons.add));\n    await tester.pumpAndSettle();\n  }\n\n  @Then('counter should be {int}')\n  Future\u003cvoid\u003e counterShouldBe(WidgetTester tester, int counter) async {\n    debugPrint('counter should be $counter');\n\n    expect(find.text('$counter'), findsOneWidget);\n  }\n}\n\n```\n\nRun `build_runner` to generate the step definitions file\n\n```bash\ndart run build_runner build --delete-conflicting-outputs\n```\n\nCreate your entry point in `test` directory\n\n```dart\n// test/cucumber_test.dart\nimport 'counter_steps.pickled.dart';\n\nmain() =\u003e runFeatures();\n```\n\n#### Run your tests as Widget tests\n\n```bash\nflutter test test/cucumber_test.dart\n# or\nflutter test\n```\n\n#### Run your tests as Integration tests\n\nCreate your entry point in `integration_test` directory\n\n```dart\n// integration_test/app_test.dart\nimport 'package:integration_test/integration_test.dart';\n\nimport '../test/counter_step_definitions.g.dart';\n\nvoid main() {\n  IntegrationTestWidgetsFlutterBinding.ensureInitialized();\n\n  runFeatures();\n}\n```\n\nRun your tests\n\n```bash\nflutter test integration_test/app_test.dart\n```\n\n## Additional features\n\n### Background Steps\n\nPickled Cucumber supports **Background** steps, which are common steps that run before each scenario in a feature file. This powerful feature allows you to:\n\n- **Eliminate code duplication**: Define common setup steps once instead of repeating them in every scenario\n- **Improve test readability**: Keep scenarios focused on their specific logic by moving setup to the background\n- **Ensure consistent test state**: All scenarios start from the same well-defined initial state\n- **Simplify maintenance**: Update common setup logic in one place\n\n#### Syntax\n\n```gherkin\nFeature: User Management\n\n  Background:\n    Given the application is running\n    And I am logged in as an administrator\n    And I navigate to the user management page\n\n  Scenario: Create new user\n    When I click on \"Add User\" button\n    And I fill in the user form\n    Then a new user should be created\n\n  Scenario: Delete existing user\n    When I select an existing user\n    And I click on \"Delete\" button\n    Then the user should be removed from the list\n```\n\n#### How it works\n\n1. **Execution order**: For each scenario, Pickled Cucumber first executes all steps defined in the `Background` section, then executes the scenario's own steps\n2. **Isolation**: Each scenario gets a fresh execution of the background steps, ensuring test isolation\n3. **Inheritance**: All scenarios in the same feature file automatically inherit the background steps\n\n## Links\n\n- [Learn Cucumber](https://cucumber.io/docs/guides/overview/)\n- [Learn Dart](https://dart.dev/guides)\n- [Learn Dart Frog](https://dartfrog.vgv.dev/)\n- [Learn Flutter](https://flutter.dev/docs)\n\n## Contributors\n\nReally thanks to the open source contributors on this project !\n\n* [@mmarchal](https://github.com/mmarchal)\n\n* [@FlorianFlouquet](https://github.com/FlorianFlouquet)\n\n* [@RBisiaux](https://github.com/RBisiaux)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrfleury%2Fpickled_cucumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiotrfleury%2Fpickled_cucumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrfleury%2Fpickled_cucumber/lists"}