Skip to content
pubscout

parameterized_test

2.0.3, released 5 months ago by dutchcodingcompany.com

Run a Dart test multiple times based on provided parameter lists.

WASM-ready
$ flutter pub add parameterized_test
Source repository

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.

Works with

Packages commonly used together with parameterized_test: ones it builds on, ones built on it, and its own family.