Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration test with integration_test package #3009

Closed
bsr203 opened this issue Dec 12, 2020 · 2 comments · Fixed by #3133
Closed

Integration test with integration_test package #3009

bsr203 opened this issue Dec 12, 2020 · 2 comments · Fixed by #3133
Labels
in debugger Relates to the debug adapter or process of launching a debug session in flutter Relates to running Flutter apps is enhancement
Milestone

Comments

@bsr203
Copy link

bsr203 commented Dec 12, 2020

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

@bsr203 bsr203 changed the title Integration test with flutter drive command Integration test with integration_test package Dec 12, 2020
@bsr203
Copy link
Author

bsr203 commented Dec 15, 2020

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!

@bsr203
Copy link
Author

bsr203 commented Dec 15, 2020

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

@DanTup DanTup added this to the v3.18.0 milestone Dec 16, 2020
@DanTup DanTup added in debugger Relates to the debug adapter or process of launching a debug session in flutter Relates to running Flutter apps labels Dec 16, 2020
@DanTup DanTup modified the milestones: v3.18.0, v3.19.0 Dec 21, 2020
@DanTup DanTup modified the milestones: v3.19.0, On Deck Jan 19, 2021
@DanTup DanTup modified the milestones: On Deck, v3.20.0 Feb 8, 2021
@DanTup DanTup modified the milestones: v3.20.0, v3.21.0 Feb 17, 2021
@DanTup DanTup modified the milestones: v3.21.0, v3.22 Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session in flutter Relates to running Flutter apps is enhancement
Projects
None yet
2 participants