Member-only story

A Hole In The Flutter SDK, Decent Goldens Testing

Fred Grott
4 min readOct 1, 2023

Google through the Flutter SDK only provides a minimum Continuous Integration way to execute goldens visual regression testing. There is a better way to do it using the alchemist package, let me show you how!

How Goldens Testing Works

To understand how goldens testing works, we have to understand what is at the core of unit testing in the form of the pumpWidget:

The pumpWidget method just calls the runApp method function with a widget and then triggers a frame. This means that we are not running the full app, but instead using the widget or screen of widgets to get a visual frame instead.

To write a Flutter SDK goldens test, we would do something where we call testWidgets and pumpWidget, such as:

--

--

Fred Grott
Fred Grott

Responses (1)