Flutter tests

Flutter offers unit tests for logic, widget tests that build a widget and simulate interactions with WidgetTester, and integration tests on the complete app. They run with flutter test and verify behavior without an emulator for the first two types.

Example

testWidgets('shows the title', (tester) async {
  await tester.pumpWidget(const MaterialApp(home: Text('Hi')));
  expect(find.text('Hi'), findsOneWidget);
});

Related concepts

The whole glossary