gherkin
3.1.0, released 4 years ago by an unverified publisher
A Gherkin parser and test runner for BDD testing in Dart and Flutter.
What it does
It provides a fully featured Gherkin parser and test runner similar to Cucumber. It lets developers write feature files using BDD syntax and run them using explicitly provided step definitions, hooks, and configuration files.
AI-written summary of version 3.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to write Behaviour Driven Development (BDD) tests using Gherkin feature files in Dart or Flutter.
- You need to test your application scenarios with step definitions and custom world contexts without relying on reflection.
Skip it when
- You prefer standard widget or unit tests without feature files.
- You require automatic reflection-based step discovery.
Strengths
- Does not rely on mirrors/reflection, making it compatible with Flutter's constraints.
- Closely follows Cucumber standards and syntax.
- Supports customizable reporters, hooks, and step parameters.
Weaknesses
- Requires explicit configuration and manual registration of steps, hooks, and parameters.
- Setup can be verbose compared to standard testing frameworks.
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 4
Requires creating feature files, writing step definition classes, and setting up a configuration runner manually.
Future<void> main() {
final steps = [
givenTheNumbers(),
whenTheStoredNumbersAreAdded(),
thenExpectNumericResult()
];
final config = TestConfiguration.standard(
steps,
hooks: [HookExample()],
customStepParameterDefinitions: [PowerOfTwoParameter()],
createWorld: (config) => Future.value(CalculatorWorld()),
);
return GherkinRunner().execute(config);
}Alternatives
Packages that do the same job and could replace gherkin.
- very_good_test_runner
A Dart/Flutter test runner that streams TestEvent objects from dart test or flutter test.
88Compare - pickled_cucumber
A simple Cucumber BDD implementation for Dart, Dart Frog, and Flutter projects.
62Compare - cucumber_gherkin
Parses Gherkin .feature files into Cucumber Messages envelopes
81Compare
Works with
Packages commonly used together with gherkin: ones it builds on, ones built on it, and its own family.