首页 > 解决方案 > Listener or rule for flutter_driver tests, to make automatically screenshot, if any one test failed

问题描述

Hello!

There is huge trouble with taking automatically screenshot in flutter, if any test failed in test suite. In general I mean the same solution as it working in JUnit or TestNG. Also I'm tried to wrap all test cases in try/catch, but it didn't work properly... Please help if have any idea how to solve it. Thanks in advance)

For example

In JUnit it's:

import com.codeborne.selenide.junit.ScreenShooter;

public class MyTest {
    @rule
    public ScreenShooter makeScreenshotOnFailure = ScreenShooter.failedTests();
        // `enter code here`
}

In TestNG it's:

import com.codeborne.selenide.testng.ScreenShooter;

@listeners({ ScreenShooter.class})
public class MyTest {
    // `enter code here`
}

标签: flutterautomationintegration-testingscreenshotflutterdriver

解决方案


推荐阅读