flutter drive

Run integration tests for the project on an attached device or emulator

Options

NameDescription
-h, --helpPrint this usage information
-v, --verboseNoisy logging, including all shell commands executed. If used with --help, shows hidden options
-d, --device-id <device id>Target device id or name (prefixes allowed)
--suppress-analyticsSuppress analytics reporting when this command runs
--debugBuild a debug version of your app (default mode)
--profileBuild a version of your app specialized for performance profiling
--releaseBuild a release version of your app
--dart-define <foo=bar>Additional key-value pairs that will be available as constants from the String.fromEnvironment, bool.fromEnvironment, int.fromEnvironment, and double.fromEnvironment constructors
--flavorBuild a custom app flavor as defined by platform-specific build setup. Supports the use of product flavors in Android Gradle scripts, and the use of custom Xcode schemes
--web-rendererThe renderer implementation to use when building for the web. Possible values are: html - always use the HTML renderer. This renderer uses a combination of HTML, CSS, SVG, 2D Canvas, and WebGL. This is the default. canvaskit - always use the CanvasKit renderer. This renderer uses WebGL and WebAssembly to render graphics. auto - use the HTML renderer on mobile devices, and CanvasKit on desktop devices. [auto (default), canvaskit, html]
--trace-startupTrace application startup, then exit, saving the trace to a file
--verbose-system-logsInclude verbose logging from the flutter engine
--cache-skslOnly cache the shader in SkSL instead of binary or GLSL
--dump-skp-on-shader-compilationAutomatically dump the skp that triggers new shader compilations. This is useful for writing custom ShaderWarmUp to reduce jank. By default, this is not enabled to reduce the overhead. This is only available in profile or debug build
--purge-persistent-cacheRemoves all existing persistent caches. This allows reproducing shader compilation jank that normally only happens the first time an app is run, or for reliable testing of compilation jank fixes (e.g. shader warm-up)
--routeWhich route to load when running the app
--vmservice-out-file <.txt output file path>A file to write the attached vmservice uri to after an application is started. e.g. project/example/out.txt
--use-application-binary <file path to .apk>Specify a pre-built application binary to use when running. For android applications, this must be the path to an APK. For iOS applications, the path to an IPA. Other device types do not yet support prebuilt application binaries. e.g. path/to/app.apk
--endless-trace-bufferEnable tracing to the endless tracer. This is useful when recording huge amounts of traces. If we need to use endless buffer to record startup traces, we can combine the ("--trace-startup"). For example, flutter run --trace-startup --endless-trace-buffer
--trace-systraceEnable tracing to the system tracer. This is only useful on platforms where such a tracer is available (Android and Fuchsia)
--trace-skiaEnable tracing of Skia code. This is useful when debugging the raster thread (formerly known as the GPU thread). By default, Flutter will not log skia code
-a, --dart-entrypoint-args
  • Repeatable ♾
-t, --target <.dart file path>The main entry-point file of the application, as run on the device. If the --target option is omitted, but a file name is provided on the command line, then that is used instead. (defaults to "lib/main.dart")
--observatory-port(deprecated use host-vmservice-port instead) Listen to the given port for an observatory debugger connection. Specifying port 0 (the default) will find a random free port
--device-vmservice-portLook for vmservice connections only from the specified port. Specifying port 0 (the default) will accept the first vmservice discovered
--host-vmservice-portWhen a device-side vmservice port is forwarded to a host-side port, use this value as the host port. Specifying port 0 (the default) will find a random free host port
--pubRun 'flutter pub get' before executing this command
--no-pubDon't run 'flutter pub get' before executing this command
--track-widget-creationTrack widget creation locations. This enables features such as the widget inspector. This parameter is only functional in debug mode (i.e. when compiling JIT, not AOT)
--no-track-widget-creationNo tracking widget creation locations. This disables features such as the widget inspector. This parameter is only functional in debug mode (i.e. when compiling JIT, not AOT)
--null-assertionsPerform additional null assertions on the boundaries of migrated and un-migrated code. This setting is not currently supported on desktop devices
--no-null-assertionsNot performing additional null assertions on the boundaries of migrated and un-migrated code. This setting is not currently supported on desktop devices
--device-user <seconds>Identifier number for a user or work profile on Android only. Run "adb shell pm list users" for available identifiers
--device-timeout <seconds>Time in seconds to wait for devices to attach. Longer timeouts may be necessary for networked devices
--dds-portWhen this value is provided, the Dart Development Service (DDS) will be bound to the provided port. Specifying port 0 (the default) will find a random free port
--devtools-server-addressWhen this value is provided, the Flutter tool will not spin up a new DevTools server instance, but instead will use the one provided at this address
--keep-app-runningWill keep the Flutter application running when done testing. By default, "flutter drive" stops the application after tests are finished, and --keep-app-running overrides this. On the other hand, if --use-existing-app is specified, then "flutter drive" instead defaults to leaving the application running, and --no-keep-app-running overrides it
--no-keep-app-running
--use-existing-app <URL>Connect to an already running instance via the given observatory URL. If this option is given, the application will not be automatically started, and it will only be stopped if --no-keep-app-running is explicitly set
--driver <driver>The test file to run on the host (as opposed to the target file to run on the device). By default, this file has the same base name as the target file, but in the "test_driver/" directory instead, and with "_test" inserted just before the extension, so e.g. if the target is "lib/main.dart", the driver will be "test_driver/main_test.dart"
--build(Deprecated) Build the app before running. To use an existing app, pass the --use-application-binary flag with an existing APK (defaults to on)
--no-build
--driver-port <port number>The port where Webdriver server is launched at. Defaults to 4444
--headlessWhether the driver browser is going to be launched in headless mode. Defaults to true
--no-headless
--browser-nameName of browser where tests will be executed. Following browsers are supported: Chrome, Firefox, Safari (macOS and iOS) and Edge. Defaults to Chrome. [android-chrome, chrome (default), edge, firefox, ios-safari, safari]
--browser-dimensionThe dimension of browser when running Flutter Web test. This will affect screenshot and all offset-related actions. By default. it is set to 1600,1024 (1600 by 1024). (defaults to "1600,1024")
--android-emulatorWhether to perform Flutter Driver testing on Android Emulator.Works only if 'browser-name' is set to 'android-chrome'
--no-android-emulator
--chrome-binaryLocation of Chrome binary. Works only if 'browser-name' is set to 'chrome'
--write-sksl-on-exitAttempts to write an SkSL file when the drive process is finished to the provided file, overwriting it if necessary
--test-argumentsAdditional arguments to pass to the Dart VM running The test script