Beginning Integration Testing

Fred Grott
4 min readFeb 9, 2021

The reason why you the beginning flutter developer should do integration testing is because in the app market app users expect a-widget-pixel-perfect-app. And, integration testing is a way to see that all widgets exhibit the behavior that our app users expect.

In the Fall of 2020 the Flutter SDK switched integration testing to being more compatible with Continuous Integration Servers and thus we have a new and easier way to quickly get into integration testing flutter apps. I am going to show you that new easy way.

Pre-Requirements

The Flutter SDK team has not updated docs everywhere so one important env variable is not in the flutter sdk install directions. You should get use to setting a VM_SERVICE_URL as you need that in your CI set-up later on and for any terminal commands.

The variable set up is this no matter what OS you happen to be on:

VM_SERVICE_URL=http://127.0.0.1:8888/

Now we need to add our integration_test package dependency in our pubspec at the dev_dependencies block:

dev_dependencies:
flutter_test:
sdk: flutter
integration_test: ^1.0.2+2

Now we are ready to add some test code to our flutter project.

Our Test Code

--

--