# Appium Flutter Integration Driver Testing

> For the full site index for AI agents, see [llms.txt](https://www.testmuai.com/support/docs/llms.txt).

TestMu AI supports testing Flutter applications on real Android and iOS devices using the [**Appium Flutter Integration Driver**](https://github.com/AppiumTestDistribution/appium-flutter-integration-driver/). This driver enables you to automate End-to-End (E2E) testing of Flutter apps in multiple programming languages, providing a powerful and flexible way to validate your Flutter apps on real devices in the cloud.

Testing Flutter apps requires embedding the **Flutter Integration Server** inside your app to enable communication between Appium and Flutter UI elements.

After preparing your Flutter app with this integration (refer to the setup documentation below), you can build, upload, and execute your tests on TestMu AI real devices using the Appium Flutter Integration Driver.

## Native Flutter Integration Driver vs Appium Flutter Integration Driver

| Feature / Use Case                                   | Native Flutter Driver | Appium Flutter Integration Driver |
|----------------------------------------------------|----------------------|----------------------------------|
| Writing tests in languages other than Dart          | No                   | Yes                              |
| Support for Flutter apps with embedded webviews or native views | No                   | Yes                              |
| Running tests on multiple devices simultaneously   | No                   | Yes                              |
| Compatible with device farms supporting Appium     | No                   | Yes                              |
| Interaction beyond Flutter context (e.g., OTP apps) | No                   | Yes                              |

## Why Use Appium Flutter Integration Driver?

- **Multi-language support:** Write tests in Java, Python, Ruby, JavaScript, and more.
- **Automatic UI synchronization:** Waits intelligently for UI elements and animations to complete.
- **Seamless context switching:** No manual switching between Flutter and native app contexts.
- **Powerful gesture support:** Supports long press, drag and drop, scroll to element, double-click, and more.
- **Element chaining:** Easily find child elements under specific parent widgets.
- **Real device cloud ready:** Supported on TestMu AI real Android and iOS devices.

## Getting Your Flutter App Ready for Testing

### 1. Add the Flutter Integration Server dependency

In your Flutter app’s `pubspec.yaml`, add:

```yaml
dev_dependencies:
appium_flutter_server: 0.0.28
```

### 2. Create integration test files

Create an `integration_test` folder at the root of your Flutter project. Inside it, create `appium_test.dart` with:

```dart
import 'package:appium_flutter_server/appium_flutter_server.dart';
import 'package:your_app_package/main.dart'; // Replace with your app's main.dart import

void main() {
initializeTest(app: const MyApp());
}
```

Or with setup callback:

```dart
import 'package:your_app_package/main.dart' as app;

void main() {
initializeTest(
callback: (WidgetTester tester) async {
// Add prerequisite setup here
await tester.pumpWidget(const app.MyApp());
},
);
}
```

### 3. Build your Flutter app with integration test

{`./gradlew app:assembleDebug -Ptarget=$(pwd)/../integration_test/appium_test.dart`}

{`flutter build ios integration_test/appium_test.dart --simulator`}

{`flutter build ipa --release integration_test/appium_test.dart`}

## Uploading Your Flutter App to TestMu AI

- For detailed instructions on how to upload your application to TestMu AI, please refer to our comprehensive guide.
- Visit the [**Upload your Application**](/support/docs/application-setup-via-api/#upload-your-application) documentation to learn more.
- Use the returned **App ID** from above step in your automation scripts.

## Sample Desired Capabilities

{`desired_caps = {
    "deviceName":"Galaxy S20",
    "platformName":"Android",
    "platformVersion":"15",
    "isRealMobile":True,  // Use False for Virtual Devices
    "app":"YOUR_APP_URL",
    "build":"Sample Build",
    "name":"Sample Test",
    "automationName": "FlutterIntegration" #Using Flutter Integration Driver
}

`}

{`desired_caps = {
    "deviceName":"iPhone 16",
    "platformName":"ios",
    "platformVersion":"18",
    "isRealMobile":True, // Use False for Virtual Devices
    "app":"YOUR_APP_URL",
    "build":"Sample Build",
    "name":"Sample Test",
    "automationName": "FlutterIntegration" #Using Flutter Integration Driver
}

`}

- You must add the generated **APP_URL** to the `app` capability in the config file.
- You must set **isRealMobile** capability to `False` in the config file to run on **Virtual Devices**
- You can generate capabilities for your test requirements with the help of our inbuilt [**Capabilities Generator tool**](https://www.testmuai.com/capabilities-generator/).For more details, please refer to our guide on [**Desired Capabilities in Appium**](/support/docs/desired-capabilities-in-appium/).
