Mock dependencies using Mockito

Widget tests

A widget test (in other UI frameworks referred to as component test)
tests a single widget. The goal of a widget test is to verify that the
widget’s UI looks and interacts as expected. Testing a widget involves
multiple classes and requires a test environment that provides the
appropriate widget lifecycle context.

For example, the Widget being tested should be able to receive and
respond to user actions and events, perform layout, and instantiate child
widgets. A widget test is therefore more comprehensive than a unit test.
However, like a unit test, a widget test’s environment is replaced with
an implementation much simpler than a full-blown UI system.

Recipes

An introduction to widget testing

Find widgets

Handle scrolling

Tap, drag, and enter text

Integration tests