Skip to content

Commit

Permalink
Add separate driver file for performance tests (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
abd99 committed Aug 28, 2021
1 parent 912418b commit 69abb61
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion testing_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 25 additions & 0 deletions testing_app/integration_test/perf_driver.dart
Original file line number Diff line number Diff line change
@@ -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<void> 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<String, dynamic>,
testOutputFilename: entry.key,
);
}
}
},
);
}

0 comments on commit 69abb61

Please sign in to comment.