Playbook

Testing mobile apps

Test effort should follow risk, not a coverage number. Where I put it:

Where money moves. A bug in a banner costs nothing; a bug in a wallet balance costs a customer. At Third Wave Coffee, most of the team’s tests sit in wallet, packs, payment and cart, which is where they belong.

Parsers, against real responses. A parser tested on hand-written JSON is tested against your assumptions. Record real responses from the backend and run parsers and screens against them, with a fixed clock so dates in assertions stay stable.

The seams. Tests on each side cannot see a name that drifted between Dart and native. I wrote tests that pin every platform-channel and method name to its exact string, so a rename on the Dart side, which would silently break the native side, fails CI instead.

Screen logic, without a device. Blocs hold the logic behind a screen, so test them as events in and states out. They run in milliseconds and catch logic bugs before anyone opens a simulator.

End-to-end, for the few flows that pay. A handful of UI tests on the paths that make money, like sign in, add to cart and pay, catch what unit tests cannot. Maestro is the tool I would choose: flows are short YAML files, it drives the real app the way a user does, and the same flow runs on Android and iOS. Keep these few. They are the slowest tests, and the first to break when the UI changes.

Logic with a reference. For maths like totals, discounts or prices, check the code against a second, independent calculation over many random inputs. “Looks right on the screen” is not a test.

What I would change. During the migration, the CI coverage gate was set low and never raised. Next time I would raise it one feature at a time, as each feature moved to Flutter.