start method

Future<void> start()

Starts the test on the Simulator.

It will kick off the run phase and continue to run until all objections have dropped.

Implementation

Future<void> start() async {
  build();
  final runPhase = Phase();
  unawaited(run(runPhase));
  if (!Simulator.hasStepsRemaining()) {
    logger.warning('Simulator has no registered events.');
  }
  logger.finest('Waiting for objections to finish...');

  await Future.any([
    Simulator.run(),
    runPhase.allObjectionsDropped(),
  ]);

  if (runPhase.objections.isNotEmpty) {
    logger
        .warning('Simulation has ended before all objections were dropped!');
  } else {
    logger.finest('Objections completed, ending simulation.');
    unawaited(Simulator.endSimulation());
  }

  if (!Simulator.simulationHasEnded) {
    await Simulator.simulationEnded;
  }

  logger.finest('Running end of test checks.');
  _checkAll();

  logger.finest('Simulation ended, test complete.');

  await _loggerSubscription.cancel();

  _instance = null;
}