How do I run flutter integration tests (flutter_driver) non locally within an infrastructure like AWS Device Farm, Saucelabs, Firebase Test Lab?
Running flutter_driver tests on my local machine works smoothly and easily however cloud based mobile testing services don't have the required dependencies installed to utilize Flutter CLI commands.
There are a few places in the Flutter repo that indicate this is possible, however I'm having a hard time finding exactly what needs to happen to make this possible (I have limited experience with Android & iOS integration testing).
A few references I've found:
A comment discussing an integration test in the flutter_gallery: https://github.com/flutter/flutter/issues/18879#issuecomment-400816050
A github issue to add a Firebase Test Lab integration test: https://github.com/flutter/flutter/issues/11718
What do I need to add to my flutter app to allow for remote integration testing inside AWS Device Farm, Saucelabs, Firebase Test Lab etc?
Thanks for your help.
Although we don't officially support the Flutter framework and Flutter tests on AWS Device Farm, we do have a way for you to run these tests using our "custom environment mode" and by pre-selecting a different, supported framework. My advice would be to do the following:
{code}
- >-
if [ $DEVICEFARM_DEVICE_PLATFORM_NAME = "Android" ];
then
# Run EC2 setup code here
curl https://storage.googleapis.com/flutter_infra/releases/beta/linux/flutter_linux_v0.11.3-beta.tar.xz -o flutter_linux_v0.11.3-beta.tar.xz
tar xf flutter_linux_v0.11.3-beta.tar.xz
fi
if [ $DEVICEFARM_DEVICE_PLATFORM_NAME = "iOS" ];
then
# Run Mac setup code here
curl https://storage.googleapis.com/flutter_infra/releases/beta/macos/flutter_macos_v0.11.3-beta.zip -o flutter_macos_v0.11.3-beta.zip
unzip -qq flutter_macos_v0.11.3-beta.zip
fi
- mv flutter ~/flutter
- echo "export PATH=$PATH:$HOME/flutter/bin">> ~/.bash_profile
- export PATH=$PATH:$HOME/flutter/bin
- flutter devices
{code}
Good luck testing on AWS Device Farm! I have confirmed that these steps do work to setup Flutter properly on our testing platform.
Note: this addresses the assumptions that lead to your question. Not a direct answer to your question.
It is possible to run Flutter integration tests on the cloud using emulators only (no actual devices). The following article describes how to set it up. The article includes a working example on Travis-CI.
Flutter unit, widget and integration testing with IOS and Android emulators on Travis-CI
Source code on GitHub, with a link to the latest build, including integration test results running on both iOS and Android, can be found here. Feel free to clone and use as a starting point for your own project.
Running integration tests on actual devices is probably something you want to do if you are building a complex app with wide distribution (a lot of users), etc...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With