Skip to content

Support running/debugging Flutter Driver integration tests #2609

@themightychris

Description

@themightychris

I'm working through this guide trying to get to a point where I can step through driver scripts and/or driven apps in VSCode: https://medium.com/flutter-community/hot-reload-for-flutter-integration-tests-e0478b63bd54

Running the terminal commands works, but I haven't been able to get either side to work when launched from VSCode yet. There seem to be two things in the way:

  • Setting a known --observation-port via "args" in launch.json seems to get overridden by the extension
  • There doesn't seem to be any way to run the driver program as a dart CLI command because the extension detects the project type from the workspace folder and offers no launch.json-level override. It gets launched on the Android device I just launched the app on, and I can breakpoint through it but it kills the app on the device to launch the driver

Here's my best guess so far:

    {
      "name": "Integration Tests: Launch App",
      "request": "launch",
      "type": "dart",
      "program": "test_driver/app.dart",
      "args": [
        "--dart-define=app.api=http://10.0.2.2:5378/api/v1", // special android IP for host, works
        "--observatory-port 4567", // doesn't seem to work
        "--disable-service-auth-codes"
      ],
      "flutterMode": "debug", // don't know if needed
    },
    {
      "name": "Integration Tests: Launch Driver",
      "request": "launch",
      "type": "dart",
      "program": "test_driver/app_test.dart",
      "deviceId": null, // this needs to run on the host computer, but it wants to run on the same device as the app
      "env": {
        "VM_SERVICE_URL": "http://127.0.0.1:4567"
      },
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin flutterRelates to running Flutter appsin testingRelates to test execution of Dart/Flutter tests for end usersis enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions