text
stringlengths
1
474
already. Then navigate to Quality > Test Lab:<topic_end>
<topic_start>
Uploading an Android APK
Create an APK using Gradle:Where <name>_test.dart is the file created in the
Project Setup section.info Note
To use --dart-define with gradlew, you must base64 encode
all parameters, and pass them to gradle in a comma separated list:Drag the “debug” APK from
<flutter_project_directory>/build/app/outputs/apk/debug
into the Android Robo Test target on the web page.
This starts a Robo test and allows you to run
other tests:Click Run a test,
select the Instrumentation test type and drag
the following two files:If a failure occurs,
you can view the output by selecting the red icon:<topic_end>
<topic_start>
Uploading an Android APK from the command line
See the Firebase Test Lab section of the README
for instructions on uploading the APKs from the command line.<topic_end>
<topic_start>
Uploading Xcode tests
See the Firebase TestLab iOS instructions
for details on how to upload the .zip file
to the Firebase TestLab section of the Firebase Console.<topic_end>
<topic_start>
Uploading Xcode tests from the command line
See the iOS Device Testing section in the README
for instructions on how to upload the .zip file
from the command line.
<topic_end>
<topic_start>Performance profiling
When it comes to mobile apps, performance is critical to user experience.
Users expect apps to have smooth scrolling and meaningful animations free of
stuttering or skipped frames, known as “jank.” How to ensure that your app
is free of jank on a wide variety of devices?There are two options: first, manually test the app on different devices.
While that approach might work for a smaller app, it becomes more
cumbersome as an app grows in size. Alternatively, run an integration
test that performs a specific task and records a performance timeline.
Then, examine the results to determine whether a specific section of
the app needs to be improved.In this recipe, learn how to write a test that records a performance
timeline while performing a specific task and saves a summary of the
results to a local file.info Note
Recording performance timelines isn’t supported on web.
For performance profiling on web, see
Debugging performance for web appsThis recipe uses the following steps:<topic_end>
<topic_start>
1. Write a test that scrolls through a list of items
In this recipe, record the performance of an app as it scrolls through a
list of items. To focus on performance profiling, this recipe builds
on the Scrolling recipe in widget tests.Follow the instructions in that recipe to create an app and write a test to
verify that everything works as expected.<topic_end>
<topic_start>
2. Record the performance of the app
Next, record the performance of the app as it scrolls through the
list. Perform this task using the traceAction()
method provided by the IntegrationTestWidgetsFlutterBinding class.This method runs the provided function and records a Timeline
with detailed information about the performance of the app. This example
provides a function that scrolls through the list of items,
ensuring that a specific item is displayed. When the function completes,
the traceAction() creates a report data Map that contains the Timeline.Specify the reportKey when running more than one traceAction.
By default all Timelines are stored with the key timeline,
in this example the reportKey is changed to scrolling_timeline.
<code_start>await binding.traceAction(
() async {
// Scroll until the item to be found appears.
await tester.scrollUntilVisible(
itemFinder,
500.0,
scrollable: listFinder,
);
},
reportKey: 'scrolling_timeline',
);<code_end>
<topic_end>
<topic_start>
3. Save the results to disk
Now that you’ve captured a performance timeline, you need a way to review it.
The Timeline object provides detailed information about all of the events
that took place, but it doesn’t provide a convenient way to review the results.Therefore, convert the Timeline into a TimelineSummary.
The TimelineSummary can perform two tasks that make it easier
to review the results:To capture the results, create a file named perf_driver.dart
in the test_driver folder and add the following code:
<code_start>import 'package:flutter_driver/flutter_driver.dart' as driver;
import 'package:integration_test/integration_test_driver.dart';
Future<void> main() {
return integrationDriver(
responseDataCallback: (data) async {
if (data != null) {
final timeline = driver.Timeline.fromJson(
data['scrolling_timeline'] as Map<String, dynamic>,
);
// Convert the Timeline into a TimelineSummary that's easier to
// read and understand.
final summary = driver.TimelineSummary.summarize(timeline);
// Then, write the entire timeline to disk in a json format.
// This file can be opened in the Chrome browser's tracing tools
// found by navigating to chrome://tracing.
// Optionally, save the summary to disk by setting includeSummary
// to true
await summary.writeTimelineToFile(
'scrolling_timeline',