I've read and tried integration testing with flutter. I followed this guide here...
https://flutter.io/docs/cookbook/testing/integration
Now, to run the integration test I have to type in the following command:
flutter drive --target=test_driver/app.dart
My question is, is there a way to automate this inside android studio so I do not have to type in the command manually. I rather just click one button and run the integration test than type the command over and over again.
I'm new in flutter over all so any suggestion will be very much appreciated. Thanks in advance.
Not sure if you found answer for your question, but I am going to post solution here. Hope it helps.
- In Android Studio, open the
run/edit configuration dialog
and select Edit Configurations
as below:
- Click on + button and select
Dart Command Line App
configuration.
- Give a name for the configuration (ex: integration.dart) and select following:
Dart file: the path of the dart file which has integration test. (ex: app_test.dart)
Working directory: root path of your project.
Environment variables: click on folder icon at extreme right in this field and create new environment variable as below:
Note that, the http
url will be different in your case. In order to find out that, run the flutter command in terminal and note the observatory url
displayed in the console. In my case, it was below:
flutter: Observatory listening on http://127.0.0.1:51150/
Replace it with yours and click OK.
Once you complete above steps properly and run the integration.dart
configuration, you should be able to run the command from Android Studio and see the results in IDE.