Flutter Integration Tests in Intellij IDEA

SimplerDevDrops
3 min readNov 1, 2020

--

IntelliJ IDEA is a brilliant IDE and it has been becoming a “industrial standard” when the subject is IDE. However, IntelliJ has some tricks when we are working with integration tests using Flutter Driver. Only to clarify, Flutter Driver is a standalone tool for integration/functional testing (end-to-end test application) for Flutter. This article will demonstrate how to run Flutter Driver tests using IntelliJ.

Systems Requirements

  • Intellij IDEA
  • Flutter Driver
  • Flutter 1.20.4
  • DART 2.9.2

STEP 01: Create a ‘Run Configurations’

Here, two Run Configurations should be done:

  • Flutter
  • Dart Command Line App
Picture 01: Firstly, Flutter -> Additional Arguments: — observatory-port 8888 — disable-service-auth-codes
Picture 02: Secondly, Dart Command Line App -> Environment variables: VM_SERVICE_URL=http://127.0.0.1:8888

All the configurations highlighted above are mandatory, and it is so important to emphasize that whether ‘Dart file’ or ‘Dart Entrypoint’ should be pointed to the Flutter-Driver folder.

IMPORTANT: When we use the option “ — disable-service-auth-codes” there is no need to apply the “App Token” in the “Environment variables — VM_SERVICE_URL”. However, only use this option in local testing environment because in automated scenarios it represents security risk.

STEP 02: Run the ‘Integration Tests’

Here, three “Runnings procedures” will be shown, and their sequence (below) are mandatory.

Picture 03: Firstly, Run the “Android Emulator”;
Picture 04: Secondly, Run the “Flutter” “Run Configuration”;
Picture 04.1: “Flutter” “Run Configuration” running Log Result
Picture 05: Lastly, Run the “Dart Command Line App” “Run Configuration”;
Picture 05.1: “Dart Command Line App” running Log Result

STEP 03: Restarting the tests in ‘Android Emulator’

To restart a test, you ought to:

  • Select your “Flutter Running Configuration” (configuration done in picture 04)
  • Use a “ Flutter Hot Restart” to restart your Integration test

In a Nutshell:

As you could see, Flutter Integration Tests in Intellij IDEA are not the “rocket science”. As you know, we are here to simplify everything for you! Please follow us, of course, if you like “Complex Contents” in a easy, simple and short steps. See you soon.

Github:

https://github.com/simplerdevdrops/02_flutter_tests_intellij

Credits and Sources:

https://medium.com/flutter-community/hot-reload-for-flutter-integration-tests-e0478b63bd54https://medium.com/@richard_62650/as-of-the-date-i-am-writing-this-this-no-longer-works-quite-like-this-1aa2c9fb4c33https://medium.com/@jdbaddley/for-anyone-coming-here-in-here-in-the-future-and-having-this-issue-dart-did-update-something-with-f749a54645a5https://www.youtube.com/watch?v=Vfi0uyDWIuM&list=PLUiueC0kTFqLvpFk_Zg55geh_TBTKnbnA&index=3

--

--

SimplerDevDrops
SimplerDevDrops

Written by SimplerDevDrops

Paulo Alves. Writer and software developer Dedicated to helping devs understand easily and fastly: DevOps, S.O.L.I.D Principles, TDD, Java Spring and Flutter.

No responses yet