resetData method

Future resetData({
  1. Logger? logger,
})

Restores the initial database state of the application under test.

This method destroys the connection to the application's database, deleting tables and data created during a test running. After the database is cleared, the application schema is reloaded and seed is invoked to re-provision static data.

This method should be invoked in TestHarness.afterStart and typically is invoked in tearDown for your test suite.

Implementation

Future resetData({Logger? logger}) async {
  await context!.persistentStore?.close();
  await addSchema(logger: logger);
  await seed();
}