Test<INPUT extends Object?, OUTPUT extends Object?> class
abstract
Test can be seen as the typed version of test function from the test package.
You can wrap multiple TestCases in a Test.
Create a new class extending Test,
provide a name and a list of testCases
and you're good to go.
Example:
class HeightTest extends Test<double, String> {
@override
final name = 'Height';
@override
run(input) {
return Height(input).toStringInMetre();
}
@override
final testCases = [
NegativeTestCase(
when: 'Negative Border height value',
input: -1,
exception: HeightNotValidException,
),
NegativeTestCase(
when: 'Zero height value',
input: 0,
exception: HeightNotValidException,
),
ValueTestCase(
when: 'Positive Border height value',
then: 'outputs value in m',
input: 1,
output: '0.01 m',
),
];
}
- Implementers
Constructors
- Test([String? name])
-
const
-
Test.multi({String? name, required ParameterizedCallback<
INPUT, OUTPUT> action, required Iterable<TestCase< cases, Callback? initialize, Callback? dispose})INPUT, OUTPUT> > -
factory
-
Test.single({String? name, required String when, required String then, required INPUT input, required dynamic matcher, required ParameterizedCallback<
INPUT, OUTPUT> action, String? testOn, Timeout? timeout, dynamic skip, dynamic tags, Map<String, dynamic> ? onPlatform, int? retry}) -
factory
Properties
Methods
-
copyWith(
{String? name, Callback? initialize, Callback? dispose}) → Test< INPUT, OUTPUT> -
dispose(
) → dynamic -
execute(
) → void -
initialize(
) → dynamic -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
INPUT input) → OUTPUT -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited