Member-only story

Cool Goldens

Fred Grott
4 min readFeb 13, 2021

--

You know what the most under-rated benefits of goldens tests is? The ability to test responsive layouts without the emulator integration tests!

I am going to show you cool way to run golden tests so you get that benefit of having the responsive layouts tested even before you write as single integration test.

Pre-Requirements

To get the extra benefits I am going to show you who to use a set of plugins from eBay Inc that extend golden test. By listing the the golden_toolkit dep in your pubspec it will load he other eBay dependencies along with that plugin:

dependencies:
golden_toolkit: ^0.8.0

We are not done yet as we need to add one line to the gitignore file:

# don't check in golden failure output
**/failures/*.png

as we do not want the failures tracked by git.

One last thing, set up an image subdirectory that the golden_toolkit plugin looks for.

Now I am going to show the full benefit of the golden_toolkit and I will be re-using the app code created when you first create a flutter project.

Goldens Configuration

Now, one of the expert tips of widget testing, set upa flutter_test_config dart file:

--

--

Fred Grott
Fred Grott

No responses yet