SerializableListTester<T> class

This helps you easily write unit tests that have a serializable output.

Based on the ListTesterMode you use, this will either generate the expected output or test against the expected output generated with a previous ListTesterMode.generateOutput call.

Please see test/example_test.dart for some example usage of this class.

If you need a version for Widget tests, please see SerializableListWidgetTester

Mixed-in types

Constructors

SerializableListTester({required String testGroupName, required String mainTestName, required FutureOr<void> testFunction(T testInput, SerializableTester tester), required Map<String, T Function()> testMap, ListTesterMode mode = ListTesterMode.testOutput})
testGroupName and mainTestName are passed as the test groups this tester is a part of.

Properties

hashCode int
The hash code for this object.
no setterinherited
mainTestName String
The name for the test. Will be used to determine the filename for the test output.
final
mode ListTesterMode
The mode to determine what to do with the output for this test run.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
testFunction FutureOr<void> Function(T testInput, SerializableTester tester)
The function that will be ran for each test case in testMap
final
testGroupName String
The name for the test group. Will be used to determine the file path for the test output.
final
testMap Map<String, T Function()>
Holds the test cases with the test name being the key and the supplier function for the test case being the value.
final

Methods

generateListTester(String path, String testName, [ListTesterMode? modeOverride]) Future<SerializableTester>
Generates the SerializableTester that will be used in runTests
inherited
generatePath() String
Generates the path that this tester will use in runTests
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runTest(String path, String testName) Future<void>
Runs a single test given the path and testName to determine the output location and mode to determine what to do with the output.
runTests() Future<void>
Run the tests under the current mode
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited