-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
☂️ Proposal: Make on-device testing awesome 💫 #148028
Comments
I did a quick search in
Interestingly, we use |
integration_test uses flutter_driver though, so there isn't really an A or B. Some of the applications written using integration_test will still be doing a flutter_driver style test. There was also a "migration" attempt that updated a bunch of tests to use integration_test and in the process kneecapped the benchmark results. |
The question at hand is, where do we invest our time, and what do we tell our teams to use? In other words, say we want to add support to talk to the native platform. Do we add that exclusively in |
integration_test is just re-exporting parts of flutter_driver and flutter_test though |
@jonahwilliams thanks for all this context. I was walking my dog tonight and I thought "I bet integration_test uses driver under the hood" glad to have it confirmed without me having to ask :) Let me try to reframe Matan's point (and correct me if I'm wrong Matan): We need to decide what our public on-device testing API is. This may(will) be based on Additionally I think we should prioritize:
|
I think all of these are possible. Some of them even work today. The problem is they are not coherently presented, nor uniformly available. For example, hot restarting flutter unit tests works! but you have to flutter run the test (which is at best .. lightly documented), and the result reporting doesn't work. |
I'm glad to hear that a lot of the implementation bits are already available. And, yeah, I think this is mostly about uniform implementation and coherent APIs |
To link related work, @bkonyi wrote up Non-Dart Developer Tooling Capabilities Exploration, relevant sections:
|
Update: @goderbauer @jonahwilliams @matanlurey @johnmccutchan met today and chatted about this. We talked about either/or enhancing Flutter Driver and The conclusion was to enhance Next steps involve starting with Concretely, I'll start working on a test suite in |
Hi @matanlurey! That’s an excellent summary of the current solutions existing in the SDK. Diclaimer: I’m one of the authors of Patrol - a framework made exactly to solve some of the issues you described. I’d like to shed some light on what choices we had to make and how community feedback has driven us there.
That was a main blocker for us, since almost every mobile app has some kind of a permission dialog or 3rd party SDK integration that is on the business critical path and you can’t just skip it. Also, to have real end-to-end device tests, we have to be able to interact with everything like a real user would. Patrol introduces both convenience methods like
This is related to how That’s what we do in Patrol - when you run
Because of that, tests are not run in isolation (which can increase flakiness) and what is more important - if 99th test crashes, you lose all the results which can be very harsh (device farms are expensive). Also, every test is having “<1s” test duration, because from a native perspective the tests return immediately. That’s what we also kinda solved in Patrol, because of running the tests “from the native side”.
This includes things like waiting for something to be interactive, finding first by default, simpler ancestor/descendant methods, etc. We created patrol_finders package for that just adds an opinionated layer for that - and I believe this is a perfect balance that low-level
@johnmccutchan mentioned being able to iterate quickly with hot restart while writing integration tests. Please take a look at Finally, we as Patrol team are very interested in what decisions are going to be made with both
|
I have two requests which would help make the end solution fully feature complete:
This would be huge as it would allow for JSON reports to be generated and then later parsed to create reports and GitHub comments in GitHub Action workflows which would highlighting test results
This is available with Footnotes
|
Requesting this to be considered as well to help avoid flakey test results which might be caused by slower than usual networking request results |
Adding some context here regarding
|
Some examples of things @johnmccutchan and I would like to do, but can't today:
We should do something about it. A couple of options on the table include:
flutter_driver
, keepingintegration_test
more or less where it is todayintegration_test
, keepingflutter_driver
more or less where it is todayOutside of Flutter, here are some popular integration test solutions for similar problem spaces:
Read more about the background of
flutter_driver
vintegration_test
Background
Flutter ships with
package:flutter_test
, and the accompanying command,flutter test
, which runs a headless version of Flutter (calledflutter_tester
) and runs Dart-based unit/functional tests, called widget tests, in a fake environment where the passage of time is controlled by the tester, with many extension points are stubbed out (like platform channels), and a software-based renderer that is ~mostly platform agnostic (and does not require a GPU, for example).This workflow provides super fast lightweight tests that are suitable for testing widgets and compositions of widgets. It's possible to interact with the widget(s) under test, observe changes as a result, and even take screenshots and compare them for golden-file testing.
Notably, this fake environment has the following limitations:
Flutter also ships with two "integration test" packages, flutter_driver and integration_test, which unfortunately are in a state2 of neither being completed nor deprecated. It would take a lot of words to describe the current state, so instead focusing on some key points:
Flutter Driver
Runs the test script on the host, using a different API (similar to ChromeDriver) than tests authored with
flutter_test
.PROs:
adb
or forcing a Dart VM GCCONs:
Finder
s cannot be re-used acrossflutter_test
andflutter_driver
Integration Test
PROs:
flutter_test
CONs:
adb
, Dart VM, etc)/cc @goderbauer @tugorez @jonahwilliams
Footnotes
It is technically possible to
flutter run
aflutter_test
and have it run on a real device; however many of the limitations remain. ↩Google employees can also read the internal-only go/flutter-integration-testing. ↩
The text was updated successfully, but these errors were encountered: