Skip to content
pubscout

patrol

4.11.0, released 3 weeks ago by leancode.co

Multiplatform E2E UI testing framework for Flutter

Rock solid
$ flutter pub add patrol
Source repository

What it does

Patrol extends flutter_test and integration_test to allow native UI automation and custom finders. It works on Android, iOS, web, macOS and requires the patrol_cli tool for native setup.

AI-written summary of version 4.11.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Need to test native platform interactions (e.g., pressing home, opening notifications).
  • Require cross‑platform E2E tests for Flutter apps.
  • Want concise, readable tests with custom finders.

Skip it when

  • Only widget tests are needed, no native interaction.

Strengths

  • Native automation across multiple platforms
  • Custom finder system for concise tests
  • Bundled agent skills for AI‑assisted test writing
  • Open‑source and battle‑tested

Weaknesses

  • Requires additional patrol_cli installation and native setup
  • Learning curve for native automation APIs
  • Not suitable for simple widget tests

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
13

Install patrol_cli, follow native setup docs for each platform (Android, iOS, macOS, web).

```dart
import 'package:patrol/patrol.dart';

void main() {
  patrolTest('counter state is the same after going to home and going back', ($) async {
    await $.pumpWidgetAndSettle(const MyApp());
    await $(FloatingActionButton).tap();
    expect($(#counterText).text, '1');
    await $.platform.mobile.pressHome();
    await $.platform.mobile.pressDoubleRecentApps();
    expect($(#counterText).text, '1');
    await $(FloatingActionButton).tap();
    expect($(#counterText).text, '2');
    await $.platform.mobile.openNotifications();
    await $.platform.mobile.pressBack();
  });
}
```

Alternatives

Packages that do the same job and could replace patrol.

  • flame_test

    Classes and helpers for testing applications built with the Flame Engine.

  • test

    A full featured library for writing and running Dart tests across platforms.

  • bdd_widget_test

    Generate Flutter widget tests from Gherkin feature files

  • bloc_test

    A testing library that makes it easy to test blocs and cubits.

Works with

Packages commonly used together with patrol: ones it builds on, ones built on it, and its own family.