---
title: Testing Flutter Apps with Appium | Testing Resources
description: Learn how to do automated mobile app testing with Flutter and Appium.
source_url:
  html: https://testingbot.com/resources/articles/appium-flutter-app-testing
  md: https://testingbot.com/resources/articles/appium-flutter-app-testing.md
---

![Testing Flutter Apps with Appium](https://testingbot.com/assets/resources/articles/13.webp)

# Appium Testing for Flutter Apps

Learn how to do automated mobile app testing with Flutter and Appium.

By [Jochen D.](https://testingbot.com/about/jochen-d)2021-11-16

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

Flutter is an open-source UI development framework, created by Google, to do cross-platform app development on iOS, Android, Linux, macOS and Windows.   
 The idea is that you write code once, then compile it for different platforms, similar to the React Native framework by Facebook.

Flutter offers nice features for developers:

- Extensive [documentation](https://flutter.dev/docs) to get started. 
- Native Performance: Flutter code is compiled to native code for iOS/Android and other platforms. 
- Hot reload to instantly see code changes. 

Because of the increasing popularity in Flutter, this article will give an overview on how to run automated mobile app tests with Flutter apps and Appium.

## Table of Contents

- [What is Flutter Framework?](https://testingbot.com#framework)
- [What programming language does Flutter use?](https://testingbot.com#language)
- [How to create a Flutter app?](https://testingbot.com#create)
- [How to use the Appium Flutter Driver?](https://testingbot.com#appium)
- [How to build a Flutter app for testing?](https://testingbot.com#build)

## What is Flutter Framework?

Flutter is a UI development framework, open-sourced by Google. It allows developers to create mobile apps on multiple platforms (including iOS and Android), with a single codebase.

The advantage of using a framework such as Flutter is that you no longer need to learn multiple programming languages for multiple platforms. You no longer need to learn **Objective-C** or **Swift** for iOS, or **Java** / **Kotlin** for Android.

Maintaining a single code base for app development means developers will be able to switch more easily between platforms and save time fixing bugs and implementing features.

## What programming language does Flutter use?

Flutter apps are written in the **Dart** programming language. The app runs in the Dart virtual machine, which supports hot reloading. The apps are compiled directly to machine code, either x86 or ARM, or in JavaScript if compiled for the web.

At the core of Flutter is the **Flutter engine** , written in C++, which is responsible for UI, networking, compiling and more.

The **Flutter framework** is the component that is used by the developers. Flutter uses a reactive UI framework, similar to Facebook's React framework.

## How to create a Flutter app?

Flutter is easy to install and configure. Simply follow the [getting started documentation](https://flutter.dev/docs/get-started/install) in the official Flutter documentation.

You'll need to download and install the **Flutter SDK** and XCode or Android Studio, depending on which targets you want to provide.   
 You can use the `flutter doctor` command to see if you have everything set up correctly.

Once you've configured everything, you can use a flutter command to create a demo application for you:

```bash
flutter create demo_app
```

This command will create a directory with a bunch of files, necessary to build and run your Flutter app.   
 To see the actual code of the demo app's main screen, check out `lib/main.dart`

## How to use the Appium Flutter Driver?

The [Appium Flutter Driver](https://github.com/appium-userland/appium-flutter-driver) allows you to run test automation against Flutter apps.   
 Before you install the Appium Flutter Driver, make sure you have a working setup of Appium.   
 You'll also need to compile your Flutter app in either **debug** or **profile** mode and use the **enableFlutterDriverExtension** before `runApp`.

To get started, please make sure to follow these steps:

1. Make sure your app's `pubspec.yaml` file contains: 

2. Import the new `dev_dependencies` that you have added in the previous step. 

3. Your `main.dart` file should contain `enableFlutterDriverExtension()` before `runApp`. 

4. Make sure to import the `flutter_driver_extension` library in your `main.dart` file.   
 The Appium Flutter driver needs this to be included. 

5. The `automationName` in your desired capabilities should be set to `Flutter`. 

Below is a simple example on how to run a Flutter Automation test on a TestingBot device.

```javascript
const wdio = require('webdriverio');
const assert = require('assert');
const { byValueKey } = require('appium-flutter-finder');

const caps = {
  platformName: 'Android',
  deviceName: 'Pixel 6',
  version: '12.0',
  app: 'https://github.com/testingbot/flutter-demo-app/releases/download/v1.0.0/demo.apk'
};

const opts = {
  capabilities: {
    ...caps,
    automationName: 'Flutter',
    retryBackoffTime: 500,
    hostname: 'hub.testingbot.com'
  },
  user: '...',
  key: '...'
};

(async () => {
  const counterTextFinder = byValueKey('counter');
  const buttonFinder = byValueKey('incrementButton');

  const driver = await wdio.remote(opts);

  assert.strictEqual(await driver.getElementText(counterTextFinder), '0');

  await driver.elementClick(buttonFinder);
  await driver.touchAction({
    action: 'tap',
    element: { elementId: buttonFinder }
  });

  assert.strictEqual(await driver.getElementText(counterTextFinder), '2');

  driver.deleteSession();
})();
```

You can use several Finders via the Flutter API:

- [ancestor](https://api.flutter.dev/flutter/flutter_driver/CommonFinders/ancestor.html)
- [bySemanticsLabel](https://api.flutter.dev/flutter/flutter_driver/CommonFinders/bySemanticsLabel.html)
- [byTooltip](https://api.flutter.dev/flutter/flutter_driver/CommonFinders/byTooltip.html)
- [byType](https://api.flutter.dev/flutter/flutter_driver/CommonFinders/byType.html)
- [byValueKey](https://api.flutter.dev/flutter/flutter_driver/CommonFinders/byValueKey.html)
- [descendant](https://api.flutter.dev/flutter/flutter_driver/CommonFinders/descendant.html)
- [pageBack](https://api.flutter.dev/flutter/flutter_driver/CommonFinders/pageBack.html)

In the example above, we're using `byValueKey` which means your application needs to set a key:

```javascript
Text(
  '$_counter',
  key: Key('counter'),
  style: Theme.of(context).textTheme.headline4,
)
```

## How to build a Flutter app for testing?

Before you can run tests, you will need to generate a build of your Flutter app, with the modifications from the previous step.

The command to do this depends on whether you want to build an `.apk` file for Android, or a `.ipa` file for iOS physical device, or a `.app` file for iOS simulator.

Please see the table below on how to build the app:

 OS | Build Mode | Command || Android | debug | ```bash flutter build apk --debug ``` |
| | profile | ```bash flutter build apk --profile ``` |
| iOS | debug | ```bash flutter build ios --debug ``` |
| | simulator | ```bash flutter build ios --simulator ``` |
| | profile | ```bash flutter build ios --profile ``` |

### Conclusion

The Appium Flutter driver allows developers and testers to easily test mobile Flutter apps with Appium.   
 The advantage of using a cloud based mobile device provider is that you can run tests on multiple devices, simultaneously.

You no longer need to set up, configure, maintain and update a fleet of devices. Rely on a device farm such as TestingBot to do the work for you.

More information is available in our [Flutter Automated Testing](https://testingbot.com/support/app-automate/appium/flutter) documentation section.

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![How to do localisation testing for mobile apps](https://testingbot.com/assets/resources/articles/12-9db6c7be671827ade1212fa6e476ee36e3365f01569100ee46fe22405c035760.webp)](https://testingbot.com/resources/articles/localized-testing-mobile-app)

#### [How to do localisation testing for mobile apps](https://testingbot.com/resources/articles/localized-testing-mobile-app)

Find out how to perform localisation testing with mobile ...

[Read article →](https://testingbot.com/resources/articles/localized-testing-mobile-app)

[![Automated Testing with Puppeteer](https://testingbot.com/assets/resources/articles/11-416015eb394d928299663409dccd67993b0a664f4b3ff456803fefc6bf1f325a.webp)](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

#### [Automated Testing with Puppeteer](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

Puppeteer combined with a test framework provides a great...

[Read article →](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

[![Tutorial on debugging Cypress tests](https://testingbot.com/assets/resources/articles/10-7ae9f6d9435bea1c54ec815ad535dc4a590086e6165263a9eba3441635d55726.webp)](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

#### [Tutorial on debugging Cypress tests](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

This article will focus on how to debug your Cypress test...

[Read article →](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

## Other Articles

[![How to do localisation testing for mobile apps](https://testingbot.com/assets/resources/articles/12-9db6c7be671827ade1212fa6e476ee36e3365f01569100ee46fe22405c035760.webp)](https://testingbot.com/resources/articles/localized-testing-mobile-app "How to do localisation testing for mobile apps")

### [How to do localisation testing for mobile apps](https://testingbot.com/resources/articles/localized-testing-mobile-app)

Find out how to perform localisation testing with mobile apps. Change your language or locale with Appium, XCUITest and Espresso.

[Read article →](https://testingbot.com/resources/articles/localized-testing-mobile-app)

[![Automated Testing with Puppeteer](https://testingbot.com/assets/resources/articles/11-416015eb394d928299663409dccd67993b0a664f4b3ff456803fefc6bf1f325a.webp)](https://testingbot.com/resources/articles/automated-testing-with-puppeteer "Automated Testing with Puppeteer")

### [Automated Testing with Puppeteer](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

Puppeteer combined with a test framework provides a great way to run automated browser tests. Follow this guide for more information.

[Read article →](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

[![Tutorial on debugging Cypress tests](https://testingbot.com/assets/resources/articles/10-7ae9f6d9435bea1c54ec815ad535dc4a590086e6165263a9eba3441635d55726.webp)](https://testingbot.com/resources/articles/how-to-debug-cypress-tests "Tutorial on debugging Cypress tests")

### [Tutorial on debugging Cypress tests](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

This article will focus on how to debug your Cypress tests with Cypress debugger and other developer tools.

[Read article →](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

[![Working with cookies - Selenium WebDriver](https://testingbot.com/assets/resources/articles/9-5a522a91a2140dbb74c2c0b484c669aed90159647c66f1ab98cb1b11579fea6e.webp)](https://testingbot.com/resources/articles/handling-cookies-with-selenium "Working with cookies - Selenium WebDriver")

### [Working with cookies - Selenium WebDriver](https://testingbot.com/resources/articles/handling-cookies-with-selenium)

Handling cookies with Selenium WebDriver is a common task, since most websites use cookies. In this guide, we'll show you how to do this with Selenium.

[Read article →](https://testingbot.com/resources/articles/handling-cookies-with-selenium)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
