Skip to content

Integration test with integration_test package #3009

Closed

Description

@bsr203

Hello,
I see support to run and debug integration tests using flutter_driver #2614

There is a new way to write integration tests
https://medium.com/flutter/updates-on-flutter-testing-f54aa9f74c7e
https://flutter.dev/docs/testing/integration-tests

can you please provide some guidance on how to use flutter drive command to run and debug integration tests.

Thanks
bsr

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Dec 12, 2020
  2. changed the title [-]Integration test with `flutter drive` command[/-] [+]Integration test with integration_test package[/+] on Dec 12, 2020
  3. bsr203 commented on Dec 15, 2020

    @bsr203
    Author

    updating with some of the comments from @DanTup

    The args should show up in the args field there according to the code:
    
    debugConfig.args = conf.flutterAdditionalArgs.concat(isTest ? conf.flutterTestAdditionalArgs : []).concat(debugConfig.args);
    
    
    
    Which makes me think it's deciding this file is not a test
    Ah, it's the folder
    
    && (isInsideFolderNamed(file, "test") || isInsideFolderNamed(file, "test_driver") || config.allowTestsOutsideTestFolder)
    
    If you want to have tests outside of test/test_driver, you need to set the dart.allowTestsOutsideTestFolder setting
    
    
    DanTupToday at 12:48 PM
    though arguably if integration_test is a common folder, we should add that to the list
    
    
    
    DanTupToday at 12:54 PM
    Ah, I see - so it looks like you need to run the tests using flutter drive. Since you changed that setting, we would now be running with flutter test. I think it's going to need some work to properly support this
    
    DanTupToday at 12:55 PM
    I think we should detect tests inside integration_test and run them with flutter drive, and maybe have a flutterDriveAdditionalArgs or similar
    
    
    
    Great, thanks!
    How are you running from the terminal? Is it like this?
    
    flutter drive \
      --driver=test_driver/integration_test.dart \
      --target=integration_test/foo_test.dart \
      -d <DEVICE_ID>
    I guess we need to have a way to find the test_driver script (perhaps by convention, if it exists with that name?)
    bsr203Today at 12:59 PM
    
     flutter drive   --driver=test_driver/integration_test.dart   --target=integration_test/app_test.dart   -d android --flavor dev
    
    DanTupToday at 1:00 PM
    Got it. The docs seem to suggest using that path for the driver script, so I think we can assume if that file exists and the current file is in integration_test, then we can run it like this. Thanks!
    
    
  4. bsr203 commented on Dec 15, 2020

    @bsr203
    Author

    key finding are:
    dart-code uses folder to decide test. integration_test is not in the list, but is currently recommended by flutter docs.
    integration test uses flutter drive command, so code lens need to use it instead of flutter test for integration tests.
    integration test needs to honor flutterTestAdditionalArgs, or need similar flag to pass arguments

  5. added this to the v3.18.0 milestone on Dec 16, 2020
  6. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    in flutterRelates to running Flutter apps
    on Dec 16, 2020
  7. modified the milestones: v3.18.0, v3.19.0 on Dec 21, 2020
  8. modified the milestones: v3.19.0, On Deck on Jan 19, 2021
  9. modified the milestones: On Deck, v3.20.0 on Feb 8, 2021
  10. modified the milestones: v3.20.0, v3.21.0 on Feb 17, 2021
  11. modified the milestones: v3.21.0, v3.22 on Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin flutterRelates to running Flutter appsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions