diff --git a/testing_app/README.md b/testing_app/README.md index 24c9c56f5..8d5459e36 100644 --- a/testing_app/README.md +++ b/testing_app/README.md @@ -30,7 +30,7 @@ The Flutter SDK can run unit tests and widget tests in a virtual machine, withou - Integration Tests: - Run `flutter drive --driver=integration_test/driver.dart --target=integration_test/app_test.dart` - Performance Tests: - - Run `flutter drive --driver=integration_test/driver.dart --target=integration_test/perf_test.dart --profile --trace-startup` + - Run `flutter drive --driver=integration_test/perf_driver.dart --target=integration_test/perf_test.dart --profile --trace-startup` - Using a physical device and running performance tests in profile mode is recommended. - The `--trace-startup` option is used to avoid flushing older timeline events when the timeline gets long. - State Management Tests: diff --git a/testing_app/integration_test/perf_driver.dart b/testing_app/integration_test/perf_driver.dart new file mode 100644 index 000000000..6d2ee883b --- /dev/null +++ b/testing_app/integration_test/perf_driver.dart @@ -0,0 +1,25 @@ +// Copyright 2021 The Flutter team. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:developer'; + +import 'package:integration_test/integration_test_driver.dart'; + +Future main() { + return integrationDriver( + responseDataCallback: (data) async { + // If the tests reported any data, save it to the disk. + if (data != null) { + for (var entry in data.entries) { + log('Writing ${entry.key} to the disk.'); + // Default storage destination is the 'build' directory. + await writeResponseData( + entry.value as Map, + testOutputFilename: entry.key, + ); + } + } + }, + ); +}