mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Add separate driver file for performance tests (#890)
This commit is contained in:
committed by
GitHub
parent
912418be86
commit
69abb6146a
@@ -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:
|
||||
|
||||
25
testing_app/integration_test/perf_driver.dart
Normal file
25
testing_app/integration_test/perf_driver.dart
Normal file
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user