-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[integration_test] Recommend tests to be in integration_test/
, fix example
#2986
Conversation
In flutter/plugins#2986, and flutter/flutter#64690, we want to drop the `_e2e.dart` suffix from test code, and tell users to place them in the `integration_test/` directory. This PR adds support so that tests in this directory will run on FTL.
In flutter/plugins#2986, and flutter/flutter#64690, we want to drop the `_e2e.dart` suffix from test code, and tell users to place them in the `integration_test/` directory. This PR adds support so that tests in this directory will run on FTL.
…example In this way, there is a clear distinction between integration tests that run on a device (in `integration_test/`, and widget tests that run with the flutter tester in `test/`. flutter/flutter#64690
4907805
to
9e01841
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really small correction about integration tests not being supported in dev mode in web, and about the structure of web plugins.
|
||
Invoke `IntegrationTestWidgetsFlutterBinding.ensureInitialized()` at the start | ||
of a test file, e.g. | ||
Create a `integration_test/` directory for your package. In this directory, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the cirrus file we are still using test_driver/ directory even though it is not the recommended directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I just read the recommended package structure.
Is there a reason for these recommendations? One idea that comes to my mind is: integration_test_driver.dart won't be the same for different tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't be the same but I would think for most use cases the bulk of the testing code should go into the test script that runs on the device, and the driver is mainly for reporting.
Currently, some packages place the test scripts in test/foo_e2e.dart
or test_driver/foo_e2e.dart
. This works today, because of the old e2e naming, but if they were to rename their tests to like test/foo_integration_test.dart
and test_driver/foo_integration_test.dart
, this would conflict with globbing rules today that check for the *_test.dart
suffix, hence the recommendation of a new integration_test/
directory for such tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did the renaming like this last week in the for the web engine: flutter/engine#20954
I think this approach blocks the possibilities that can be tested with e2e tests. Let me explain more in details: For example in the extended test example we are creating a driver and give it to the This way, depending on the repository, developers can handle the screenshots differently. Even better, FlutterDriver can be created differently, for example a WebDriver can enable accessibility in advance. Or FlutterDriver can be provided with different options for the driver. Also, the same application, can use different driver files since they can provide different functionalities. Due to this reasons, we will probably won't switch to this usage in web integration tests on the engine side. I also recommend keeping the other option in the documentation for power users who wants to provide a wider set of tests. |
@nturgut Sorry, I might have missed something. Can you elaborate more about how this approach blocks certain testing use cases? Customizing the driver is still possible with a custom driver file – in this PR, I have moved the extended test example to follow this proposed structure. There is a change to the command used to kick off the tests, but there is no change in functionality. |
Sorry, I might be missing something, the README suggestion is:
This suggestion might hide other possible usages. For example we can add:
In my opinion, if developer adds multiple driver files, then the advantage of the new structure is not very clear:
|
Thanks for clarifying – you're right that I wasn't clear enough in how we can use multiple driver files, I have updated the PR and linked it to the extended driver script. My understanding is that one of the goals for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the documentation.
Thanks! |
…example (flutter#2986) * [integration_test] Recommend tests to be in `integration_test/`, fix example In this way, there is a clear distinction between integration tests that run on a device (in `integration_test/`, and widget tests that run with the flutter tester in `test/`. Fix flutter/flutter#64690
…example (flutter#2986) * [integration_test] Recommend tests to be in `integration_test/`, fix example In this way, there is a clear distinction between integration tests that run on a device (in `integration_test/`, and widget tests that run with the flutter tester in `test/`. Fix flutter/flutter#64690
…example (flutter#2986) * [integration_test] Recommend tests to be in `integration_test/`, fix example In this way, there is a clear distinction between integration tests that run on a device (in `integration_test/`, and widget tests that run with the flutter tester in `test/`. Fix flutter/flutter#64690
Description
In this way, there is a clear distinction between integration tests that run on a device (in
integration_test/
, and widget tests that run with the flutter tester intest/
.Related Issues
flutter/flutter#64690