TestHarnessORMMixin class Null safety
Use methods from this class to test applications that use the Conduit ORM.
This class is mixed in to your TestHarness subclass to provide test utilities for applications that use use the Conduit ORM. Methods from this class manage setting up and tearing down your application's data model in a temporary database for the purpose of testing.
You must override context to return your application's ManagedContext
service.
You must override seed to insert static data in your database, as data is typically
cleared between tests.
You invoke resetData in your harness' TestHarness.afterStart method, and typically in your test suite's tearDown method.
class Harness extends TestHarness<MyChannel> with TestHarnessORMMixin {
@override
ManagedContext get context => channel.context;
Future seed() async {
await Query.insertObject(...);
}
}
Constructors
Properties
- context → ManagedContext?
-
Must override to return
ManagedContext
of application under test.read-only - hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
addSchema(
{Logger? logger}) → Future - Adds the database tables in context to the database for the application under test.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
resetData(
{Logger? logger}) → Future - Restores the initial database state of the application under test.
-
seed(
) → Future - Override this method to insert static data for each test run.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited