parameterized_test
2.0.3, released 5 months ago by dutchcodingcompany.com
Run a Dart test multiple times based on provided parameter lists.
What it does
Wraps around Dart's test package 'group' and 'test' functions to enable running the same test function multiple times with different parameter values. Supports custom description builders, setup/tearDown hooks, and per-parameter test options.
AI-written summary of version 2.0.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to run the same test logic against multiple sets of input data without duplicating test code.
- You need to specify test options like skip or testOn for individual parameters.
Skip it when
- You are looking for mocking libraries, golden tests, or integration testing utilities.
Strengths
- Eliminates duplicate test code for parameterized test cases
- Integrates seamlessly with the standard Dart test package
- Supports custom description builders and async tests
Weaknesses
- Limited strictly to parameterizing tests within the scope of the built-in test runner wrapper
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add parameterized_test to dev_dependencies in pubspec.yaml.
parameterizedTest(
'Fruit name matches length',
[
['kiwi', 4],
['apple', 5],
],
(String fruit, int length) {
expect(fruit.length, length);
},
);Alternatives
Packages that do the same job and could replace parameterized_test.
- patrol_log
Log package for Patrol, a Flutter-native UI testing framework
87Compare - flame_test
Classes and helpers for testing applications built with the Flame Engine.
80Compare - approval_tests
Approval tests implementation in Dart for snapshot and complex object testing.
70Compare - bdd_widget_test
Generate Flutter widget tests from Gherkin feature files
88Compare
Works with
Packages commonly used together with parameterized_test: ones it builds on, ones built on it, and its own family.