golden_test
2.2.0, released 3 weeks ago by goldentest.dev
A zero-dependency wrapper for Flutter golden tests with theme, locale, and multi-device support.
What it does
Streamlines writing golden tests in Flutter by reducing boilerplate and adding first-class support for themes, locales, text scales, and multiple devices in a single call. It automatically generates visual diffs and supports software keyboard simulation.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to write comprehensive golden tests across multiple locales, themes, and devices with minimal boilerplate.
- You need to test UI layouts with software keyboards or different accessibility text scales.
Skip it when
- You prefer low-level, unopinionated Flutter golden testing APIs without wrappers.
Strengths
- Reduces golden test boilerplate significantly.
- Built-in support for multi-device, dark mode, and localized test matrices.
- Includes software keyboard simulation and accessibility text scale options.
Weaknesses
- Opinionated structure that may not fit custom testing architectures.
- Turning on certain features like keyboard simulation can invalidate existing golden images.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
Add the package as a dev dependency and optionally configure global test settings or a flutter_test_config.dart file.
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_test/golden_test.dart';
void main() {
goldenTest(
name: 'My widget',
builder: (_) => const MyWidget(),
);
}Alternatives
Packages that do the same job and could replace golden_test.
- golden_screenshot
Utilities to automate screenshot generation using Flutter's golden tests.
76Compare - test
A full featured library for writing and running Dart tests across platforms.
90Compare - build_test
Utilities for unit testing Dart build_runner builders in memory
78Compare - alchemist
Streamlined golden testing tool for Flutter with local and CI-safe output support
94Compare
Works with
Packages commonly used together with golden_test: ones it builds on, ones built on it, and its own family.