Skip to content

[Question] Is it possible to restart a test, when some step fails? #310

Open
@DiegoVega19

Description

@DiegoVega19

I have an application developed on Android, which I am running a few tests using the package, everything works correctly.

The problem is, when I am running all the tests, and one fails, it stays on the screen where the test failed, and it does not restart for the next test.

Is it possible to implement something similar or an option that allows doing something similar? I tried using hooks but it didn't work

Hooks code:

class ResetAppBetweenScenariosHook extends Hook {
 late FlutterRunProcessHandler? _flutterRunProcessHandler;

  @override
  Future<void> onAfterStep(World world, String step, StepResult stepResult) async {
    if (stepResult.result == StepExecutionResult.fail ||
        stepResult.result == StepExecutionResult.error ||
        stepResult.result == StepExecutionResult.timeout) {
          stdout.writeln('Restarting Flutter app');
          final myAppWorld = world as FlutterWorld;
          await myAppWorld.restartApp();
        }
    return super.onAfterStep(world, step, stepResult);
  }
  
 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions