test_screenshot
0.0.8, released 2 years ago by an unverified publisher
Take screenshots during your flutter unit tests for debugging
What it does
It allows developers to capture screenshots of widget trees during Flutter unit tests by wrapping the widget tree in a Screenshotter widget and calling a tester extension method. It also supports capturing screenshots that include custom fonts and network images.
AI-written summary of version 0.0.8, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to visually debug Flutter unit tests using screenshots
- You need to capture images of rendered widgets during automated testing
Skip it when
- You are looking for golden file testing infrastructure to compare pixels against baseline images
- You are not writing Flutter unit or widget tests
Strengths
- Simple API with a Screenshotter widget and tester extension method
- Supports capturing screenshots with fonts and network images
Weaknesses
- Limited to debugging purposes during unit tests
- Not documented for pixel-by-pixel golden test matching
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Wrap the widget tree with a Screenshotter widget and call tester.screenshot() inside your testWidgets.
testWidgets('should create a screenshot', (tester) async {
await tester.pumpWidget(
Screenshotter(
child: MaterialApp(
home: Scaffold(body: Center(child: Icon(Icons.home))),
),
),
);
await tester.screenshot(path: 'screenshot.png');
});Alternatives
Packages that do the same job and could replace test_screenshot.
- fake_cloud_firestore
Fake implementation of Cloud Firestore for unit testing.
87Compare - firebase_storage_mocks
Mocks for Firebase Storage to write unit tests.
82Compare - spot
Toolkit for Flutter widget tests with chainable selectors and automatic timeline reports.
82Compare - build_test
Utilities for unit testing Dart build_runner builders in memory
78Compare
Works with
Packages commonly used together with test_screenshot: ones it builds on, ones built on it, and its own family.
- platformtest_screenshot depends on itCross‑platform abstraction for querying runtime platform info in Dart.
- filetest_screenshot depends on itPluggable, mockable file system abstraction for Dart with in-memory support.
- imagetest_screenshot depends on itPure Dart library to load, manipulate, encode, and decode various image formats.