text
stringlengths 1
372
|
|---|
<topic_end>
|
<topic_start>
|
running using the flutter command
|
these tests can be launched with the
|
flutter test command, where <device_id>:
|
is the optional device ID or pattern displayed
|
in the output of the flutter devices command:
|
this runs the tests in foo_test.dart. to run all tests in this directory on
|
the default device, run:
|
<topic_end>
|
<topic_start>
|
running in a browser
|
download and install ChromeDriver
|
and run it on port 4444:
|
to run tests with flutter drive, create a new directory containing a new file,
|
test_driver/integration_test.dart:
|
<code_start>
|
import 'package:integration_test/integration_test_driver.dart';
|
future<void> main() => integrationDriver();
|
<code_end>
|
then add IntegrationTestWidgetsFlutterBinding.ensureInitialized() in your
|
integration_test/<name>_test.dart file:
|
<code_start>
|
import 'package:flutter/material.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
import 'package:how_to/main.dart';
|
import 'package:integration_test/integration_test.dart';
|
void main() {
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); // NEW
|
testWidgets('tap on the floating action button, verify counter',
|
(tester) async {
|
// load app widget.
|
await tester.pumpWidget(const MyApp());
|
// verify the counter starts at 0.
|
expect(find.text('0'), findsOneWidget);
|
// finds the floating action button to tap on.
|
final fab = find.byKey(const key('increment'));
|
// emulate a tap on the floating action button.
|
await tester.tap(fab);
|
// trigger a frame.
|
await tester.pumpAndSettle();
|
// verify the counter increments by 1.
|
expect(find.text('0'), findsNothing);
|
expect(find.text('1'), findsOneWidget);
|
});
|
}
|
<code_end>
|
in a separate process, run flutter_drive:
|
to learn more, see the
|
running flutter driver tests with web wiki page.
|
<topic_end>
|
<topic_start>
|
testing on firebase test lab
|
you can use the firebase test lab with both android
|
and iOS targets.
|
<topic_end>
|
<topic_start>
|
android setup
|
follow the instructions in the android device testing
|
section of the README.
|
<topic_end>
|
<topic_start>
|
iOS setup
|
follow the instructions in the iOS device testing
|
section of the README.
|
<topic_end>
|
<topic_start>
|
test lab project setup
|
go to the firebase console,
|
and create a new project if you don’t have one
|
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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.