Test<INPUT extends Object?, OUTPUT extends Object?> class Null safety

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',
    ),
  ];
}
Implemented types
Implementers

Constructors

Test([String? name])
const
Test.multi({String? name, required ParameterizedCallback<INPUT, OUTPUT> action, required Iterable<TestCase<INPUT, OUTPUT>> cases, Callback? initialize, Callback? dispose})
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

cases Iterable<TestCase<INPUT, OUTPUT>>
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
name String
read-only
nameSuffix String
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

copyWith({String? name, Callback? initialize, Callback? dispose}) Test<INPUT, OUTPUT>
dispose() → dynamic
override
execute() → void
initialize() → dynamic
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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