Flutter integration test debugging while using integration_test package

Viewed 914

I am writing integration tests with integration_test package. Its working well.

I run the following command in CLI to start the testing.

flutter drive --driver=test_driver/integration_test_driver.dart --target=test/integration_tests/app_test.dart

But it requires to rebuild the app every time I re run the test. Can we avoid the rebuilding of App.

Also can a debugger be attached to the test cases like the debugging unit or widget tests.

2 Answers

If you're using VS Code, you can add a configuration in launch.json to run the test. Set the 'program' property to the path of the integration test.

   {
        "name": "Integration Test: Run Test",
        "program": "project_root/integration_test/foo_test.dart",
        "request": "launch",
        "type": "dart"
    },

Then you can add breakpoints within the test to pause execution. You can also restart the program via VS Code and the test will run again. If you don't use VS Code, it should be easy enough to set up a similar configuration in ANdroid studio.

Running Tests on VS Code Normally Runs on debug mode, so this allows you add breakpoints to your test files

Related