ozzie.flutter
Ozzie is your testing friend. Ozzie will take an screenshot during integration tests whenever you need.
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 project as ozzie/index.html
:
License
Copyright 2018 Jorge Coca
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Libraries
Dart
- dart:ui
- Built-in types and core primitives for a Flutter application. [...]
- dart:async
- Support for asynchronous programming, with classes such as Future and Stream. [...]
- dart:collection
- Classes and utilities that supplement the collection support in dart:core. [...]
- dart:convert
- Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
- dart:core
- Built-in types, collections, and other core functionality for every Dart program. [...]
- dart:developer
- Interact with developer tools such as the debugger and inspector. [...]
- dart:math
- Mathematical constants and functions, plus a random number generator. [...]
- dart:typed_data
- Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]
- dart:io
- File, socket, HTTP, and other I/O support for non-web applications. [...]
- dart:isolate
- Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]