Cucumber
This command allows you to run integration tests written in the Gherkin language using the morpheme_cucumber package. It bridges the gap between readable feature files and Flutter's integration test driver.
morpheme cucumber
Description
The cucumber command automates the following workflow:
- Generates Localization: (Optional) Ensures your l10n files are up-to-date.
- Processes Features: Discovers and parses
.featurefiles inintegration_test/features. - Compiles Tests: Converts Gherkin scenarios into a format executable by the test runner.
- Runs Tests: Executes
integration_test/cucumber_test.darton a connected device/emulator. - Generates Reports: Creates JSON and (if Node.js is available) HTML reports of the test results.
Prerequisites
- Flutter: Installed and available in PATH.
- Gherkin CLI: Required to parse feature files. Install gherkin executable and make sure to export to your PATH from this Gherkin Executable
- Node.js: (Optional) Required for generating HTML reports. Install nodejs for generate cucumber json to report html NodeJs
Usage
Run All Tests
Executes all feature files found in integration_test/features.
morpheme cucumber
Run Specific Features
Run only the login and profile feature files (e.g., login.feature, profile.feature).
morpheme cucumber login,profile
Run with Flavors
Run tests against a specific environment flavor (default is dev).
morpheme cucumber --flavor staging
Run on Specific Device
target a specific device or emulator by its ID.
morpheme cucumber --device-id emulator-5554
Options
morpheme cucumber [features] [options]
To see all available options and flags, run morpheme cucumber --help.
Available Options
| Option | Abbr | Description |
|---|---|---|
--flavor [env] | -f | Target environment flavor (default: dev). |
--device-id [id] | -d | Target specific device identifier for testing. |
--[no-]generate-l10n | Generate localization files before testing (default: true). | |
--morpheme-yaml [path] | Path to a custom configuration file. |
tip
Combine arguments for precise testing control:
morpheme cucumber login --flavor prod --device-id DEVICE_ID