testApp function

  1. @isTest
void testApp(
  1. String description,
  2. Future<void> body(
    1. WidgetTester tester
    )
)

Runs the callback inside the Flutter test environment.

This function is the same as flutter_test.testWidgets with the addition to apply the test values from the Flutterware GUI (selected locale, screen sizes, accessibility settings etc...).

Sample code

testApp('MyWidget', (tester) async {
  await tester.pumpWidget(MyWidget());
  await tester.screenshot();

  await tester.tap(find.text('Save'));
  expect(find.text('Success'), findsOneWidget);
  await tester.screenshot(name: 'Success');
});

Implementation

@isTest
void testApp(String description,
    Future<void> Function(flutter_test.WidgetTester tester) body) {
  flutter_test.testWidgets(description, withTestValues(body));
}