Nov 27, 2019

Testing Flutter Apps with Flutter Driver

Flutter Driver is a framework or a package that helps in automation testing of Flutter apps.

Author

Pavitra KinniPavitra KinniSoftware Engineer in Testing - II
Testing Flutter Apps with Flutter Driver

This article is a quick tutorial on testing Flutter apps with Flutter Driver.

About Flutter Driver?

In simple terms, Flutter Driver is a testing framework for Flutter Apps It can be used to test various UI elements and that helps to write end to end integration tests, while reducing time and effort that needs to be put in to test apps conventionally.

Flutter Driver is easy to setup and very handy to use. Here’s how to set it up on your machine:

Setup for Flutter Driver Extension.

Initial step for configuring Flutter Driver is to add the following lines into pubspec.yaml.

dev_dependencies:

  flutter_driver:

    sdk: flutter

  test: any

Note: These lines must be Indented properly in pubspec.yaml.

After adding the above lines, create one directory and name it something relevant, say test_driver, followed by two test files.

The first file will contain the methods that will help the Flutter Driver extension to call a particular function, and its name could be name.dart.

The second file will contain the actual test scripts, for which a proper name could be name_test.dart, that helps in connecting with the Flutter Driver, run tests and close existing connections.

The element can be selected by using it's KeyString. The key can be declared for any widget.

There are four keys that can be used: bySemanticlabel, byTooltip, byType and byValueKey.

Here I have mentioned only byValueKey.

 

Using Flutter Driver extension, test engineers can Tap, enter text, scroll and drag-drop programmatically.

There is nothing else required. It’s just that easy. Oh, and by the way, Flutter is all about widgets….

So, after writing tests run the following command in the terminal from root-path.

     $ flutter drive --target=test_driver/name.dart

After following the above steps, you can see the results in the console as all tests passed!

 

By using the following methods, a user can perform actions like tap, enter text and scrolling actions.

  • tap() 
  • enterText() 
  • scrollIntoView()

There are some other libraries which may help in carrying out Unit testing, like Mockito, it must be added using the following lines into pubspec.yaml:

dependencies :

    http : <newest_version>

dev_dependencies :

     test : <newest_version>

     mockito : <newest_version>

 

That’s it, folks!

For more details about Flutter Driver, click here.

Subscribe to Our Newsletter

RELATED ARTICLES

More from the engineering frontline.

Dive deep into our research and insights on design, development, and the impact of various trends to businesses.
The Bug That Doesn't Show Up in Code Review: Why Your Flutter Web App Reloads on Safari

Aug 19, 2026

The Bug That Doesn't Show Up in Code Review: Why Your Flutter Web App Reloads on Safari
A real-world look at how oversized images can trigger Safari reloads and iOS crashes in Flutter apps and how smarter image decoding prevents them.
From Prompting to Process: What Changed When Flutter Shipped Agent Skills

Aug 19, 2026

From Prompting to Process: What Changed When Flutter Shipped Agent Skills
This blog explores how Flutter Agent Skills improve AI-assisted development by combining official framework workflows with project-specific guidance for more consistent development.
Why Everything Your AI Builds Looks the Same

Aug 19, 2026

Why Everything Your AI Builds Looks the Same
This blog explores why AI-generated interfaces often look alike and explains how design systems, product context, and reusable engineering practices help teams build distinctive, scalable
How We Built the Missing Bridge from Code to Figma
Technology

Jul 10, 2026

How We Built the Missing Bridge from Code to Figma
This blog explores how AI-generated React apps get turned into fully editable, designer-ready Figma files by reading React Fiber instead of the DOM.
Building a Resilient Hybrid-Cloud Network with WireGuard HA, Route-Based Failover, and Deep Observability
Technology

Jun 27, 2026

Building a Resilient Hybrid-Cloud Network with WireGuard HA, Route-Based Failover, and Deep Observability
A practical breakdown of building resilient AWS-to-on-premises connectivity with WireGuard HA, active-standby failover, and deep packet-forwarding observability.
We Built a 114-Second AWS-to-Azure Failover. Here’s What We Learned
Technology

Jun 19, 2026

We Built a 114-Second AWS-to-Azure Failover. Here’s What We Learned
A practical guide to building a 114-second multi-cloud disaster recovery failover between AWS and Azure — what we built, what broke, and what we learned.
Cloud-Native and Cloud-Agnostic Are Not Ideologies; They Are Business-Stage Decisions
Technology

Jun 12, 2026

Cloud-Native and Cloud-Agnostic Are Not Ideologies; They Are Business-Stage Decisions
This blog explains how organizations can balance speed, scalability, and operational flexibility as they grow from startup to enterprise scale.

The Right Conversation Can Save You Six Months.

Whether you’re navigating AI adoption, modernizing legacy systems, or scaling a product - we start by listening. No pitch deck. No template. A real conversation.

Testing Flutter Apps with Flutter Driver - GeekyAnts