parameterized_test 0.0.5 parameterized_test: ^0.0.5 copied to clipboard
Simple package that helps with executing parameterized tests. Inspired by JUnit ParameterizedTest CsvValues.
example/parameterized_test_example.dart
import 'package:parameterized_test/parameterized_test.dart';
import 'package:parameterized_test/src/parameterized_source.dart';
import 'package:test/test.dart';
void main() {
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);
},
);
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);
},
);
parameterizedTest(
'Words with 4 letters',
ParameterizedSource.value([
'kiwi',
'bike',
'four',
]),
(List<dynamic> values) {
final String input = values[0];
final actual = input.length;
expect(actual, 4);
},
);
}