4

I am working on migrating from flutter_driver to integration_test package as this page indicates: https://flutter.dev/docs/testing/integration-tests

But I find the process of writing tests with integration_test package ( https://github.com/flutter/flutter/tree/master/packages/integration_test#integration_test ) very slow.

What I originally used to do with flutter_driver was to have in VSCode a file in .vscode\launch.json with the following configs:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Integration Tests: Launch App",
            "request": "launch",
            "type": "dart",
            "program": "test_driver/app.dart",
            "args": [
                "--flavor",
                "dev"
            ]
        },
        {
            "name": "Integration Tests: Launch Driver",
            "request": "launch",
            "type": "dart",
            "program": "test_driver/test/profile_test.dart",
            "env": {
                "VM_SERVICE_URL": "http://127.0.0.1:63189/wlwt0cVPix4=/#/vm"
              },
        }

    ]
}

And I used to first run "Integration Tests: Launch App" , then copy "127.0.0.1:54315/5YvmessTCI0="

From Debug Console:

√  Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:54315/5YvmessTCI0=/ws

And then pasted that into the "env" object "Integration Tests: Launch Driver" config of launch.json file

After that, I just added the name of the test I wanted to debug in "program" object of "Integration Tests: Launch Driver" config.

Finally I used to run "Integration Tests: Launch Driver" while "Integration Tests: Launch App" was running.

This allowed me to keep the App running while I could go ahead and run tests without having to build the APK every time. It was fast because it just took a few seconds to just run the flutter_driver steps and this way you could see if your steps were working as expected. I could also add breakpoints and debug my tests.

The problem is that after migrating to integration_test package, I cannot achieve this. Every time I add a new step to my tests and I want to make sure it works as expected, I have to build the APK every time and it is very time consuming.

Adding this config to launch.json :

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

And running "Integration Test: Run Test" works for adding breakpoints and run the tests. But if I make a change in a step and I want to see if it behaves as expected, I need to run it again and it takes a lot of time to build.

Is there a way to debug integration_test package tests as I did with the flutter_driver ones? The goal is to have the App running and be able to run a integration_test package test without having to build the APK every time, as we used to make with flutter_driver tests

0 Answers0