flutter
ozzie screenshot
ozzie screenshot is your testing friend. it will take a screenshot during integration tests whenever you need it.
![[2025] Ozzie Screenshot Integration Test](https://i0.wp.com/raw.githubusercontent.com/jorgecoca/ozzie.flutter/master/art/report.gif?w=770&ssl=1)
how it works
add ozzie
to your pubspec.yaml
as a dev_dependency:
dev_dependencies:
ozzie: <latest_version_here>
in your flutter integration tests, create an instance of ozzie
, pass the flutterdriver
, give it a groupname
and ask it to takescreenshot
. that simple! and whenever you have finished with tests, you can create an html report by asking ozzie
to generatehtmlreport
.
here’s an example:
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';
import 'package:ozzie/ozzie.dart';
void main() {
flutterdriver driver;
ozzie ozzie;
setupall(() async {
driver = await flutterdriver.connect();
ozzie = ozzie.initwith(driver, groupname: 'counter');
});
teardownall(() async {
if (driver != null) driver.close();
ozzie.generatehtmlreport();
});
test('initial counter is 0', () async {
await ozzie.takescreenshot('initial_counter_is_0');
});
test('initial counter is 0', () async {
driver.tap(find.bytype('floatingactionbutton'));
await ozzie.takescreenshot('counter_is_1');
});
}
after this, a report will be generated inside your flutter project as ozzie/index.html
:
![[2025] Ozzie Screenshot Integration Test ozzie screenshot integration test](https://i0.wp.com/flutterawesome.com/content/images/2018/11/report.png?w=770&ssl=1)
Comments are closed.