parameterized_source 0.2.0 copy "parameterized_source: ^0.2.0" to clipboard
parameterized_source: ^0.2.0 copied to clipboard

discontinued
outdated

Simple package that helps with executing parameterized tests. Inspired by JUnit ParameterizedTest CsvValues.

Parameterized test #

Simple package that helps with executing parameterized tests. Inspired by JUnit ParameterizedTest CsvValues. This package is a wrapper around groups and test.

Features #

This package helps executing a test multiple times with different parameters. Currently parameters can be specified as:

  • ParameterizedSource.csv
  • ParameterizedSource.value
  • ParameterizedSource.values

When using ParameterizedSource.csv the library tries to parse the values to int, double, bool or String?. If the csv value contains a empty string it will be parsed to null. This parsing can be escaped by wrapping in the values in ' or ".

For example:

Input Output
'banana, 4, apple' 'banana', 4, 'apple'
'banana, 4, ' 'banana', 4, null
'banana, "4", apple' 'banana', '4', 'apple'
'banana, 4, ""' 'banana', 4, ''

Getting started #

Include parameterized_test or when using flutter_test include flutter_parameterized_test in your projects pubspec.yaml.

Usage #

Instead of using groups or test you can now use parameterizedTest and supply it with multiple test parameters.

Csv source example:

parameterizedTest(
  'Amount of letters',
  ParameterizedSource.csv([
    'kiwi, 4',
    'apple, 5',
    'banana, 6',
  ]),
  (List<dynamic> values) {
    final String input = values[0];
    final expected = values[1];

    final actual = input.length;

    expect(actual, expected);
  },
);

Values source example:

  parameterizedTest(
    'Amount of letters',
    ParameterizedSource.values([
      ['kiwi', 4],
      ['apple', 5],
      ['banana', 6],
    ]),
    (List<dynamic> values) {
      final String input = values[0];
      final expected = values[1];

      final actual = input.length;

      expect(actual, expected);
    },
  );

Additional information #

Its just a simple wrapper to easily execute tests multiple times with different values. Feel free to leave some feedback or open an pull request :)

0
likes
0
points
39
downloads

Publisher

verified publisherdutchcodingcompany.com

Weekly Downloads

Simple package that helps with executing parameterized tests. Inspired by JUnit ParameterizedTest CsvValues.

Homepage

License

unknown (license)

Dependencies

meta

More

Packages that depend on parameterized_source