Flutter and UI Automation
Flutter and UI Automation
Flutter is an interesting framework for mobile developers, and has a lot of promise. Read on to get one dev's take on the framework.
Join the DZone community and get the full member experience.Join For Free
Flutter is key in Google’s bid to take over ‘fat’ application construction. It is a markup language for widgets for Android and iOS (with a community effort to deliver the same for Win/Lin/Mac desktops). While you could have said QML was the tech to deliver for all those platforms (and similarly pseudo-declarative), Flutter has a decent chance to take that crown. Well, given it is from Google.
I followed a great tutorial on using Flutter and FlutterDriver (its supported UI-clicking test-automation framework):
- Natalie Masse Hooper’s "How to write an integration test in Flutter” tutorial.
I went as far as to check it into GitHub, as a prep stage for this blog entry. A screenshot of the app running:
On UpWork I placed a fixed price $20 contract to add a fourth FlutterDriver test. A freelancer (Nikita Teplyakov) worked out it could be done in less than an hour, and went for it. I’ve checked that solution into a separate GH repo (rather than a branch of the first), here. There’s a single commit, that has all the changes performed in it.
The contract was to find a second field in a list control on one of the views and assert on its content:
Looking at the commit, we see that the application itself was extended to aid FlutterDriver finding that list item.
The test was added too. It efficiently located the list item and assert on its text.
It is extending the app to be more testable that worried me about Nikita’s solution. So I dived into the FlutterDriver implementation and could not see an alternative. The API for Flutter driver feels a lot like Selenium-RC from 2004 (I co-created that). It is 2018 and we need such thing to be more fluent like Selenium2’s APIs (WebDriver, 2007 or so). I went ahead and raised a feature request on the Flutter GitHub repo. Issue #20785. Yeesh, 20K issues? That’s simultaneously a statement of popularity and relevance for the tech, but also an indication of multi-year struggle it is going to be to maintain such a thing.
Of course, I could have misread the APIs and what I’m after is already available.
I think this stuff is compelling. Google is promoting it for iOS and Android. It could easily take over in time. As I said, the community has started to deliver it for Windows, Linux, and Mac. That makes five operating systems that will support it. Six would be Chromium OS (Google again). Android and Chromium OS could easily get built-in support for Flutter, meaning app-makers would not need to ship the library with the app.
Google is making Fuchsia too. It is an OS that’s rumored to be the successor to Android. Most likely it’ll emulate Android for the phones it ships on in the future. Chromium OS can already emulate Android for devices that are sufficiently powerful.
What is interesting to me is how good the “over the air” (OTA) upgrades are for Chromium. They are an order less obtrusive than the updates of iOS. Those themselves are an order less obtrusive than the updates for Windows 10 and MacOS. If Google does this right, owners of Chromebooks and Chromeboxes that are sufficiently powerful will be able to do an OTA update to replace ChromeOS with Fuchsia. All you’ll be required to do is plug in a power cable and give up 30 minutes to that automated zero-click task.
Published at DZone with permission of Paul Hammant , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.