Skip to content
Ozzie is your testing friend. Ozzie will take an screenshot during integration tests whenever you need. Ozzie will capture performance reports for you.
Dart Other
  1. Dart 98.9%
  2. Other 1.1%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Transfer to bmw-tech May 18, 2019
.github
art Prepare for v2.2.0 release (#34) May 1, 2019
example Use CircleCI as build system and report coverage from codecov (#40) May 18, 2019
lib
test Expand ozzie.yaml to fail the build based on warnings and/or errors (#33 May 1, 2019
.gitignore Remove report from repository (#31) Apr 30, 2019
CHANGELOG.md v2.2.3 -> Update Dart SDK and test version (#36) May 3, 2019
LICENSE.txt Adjusted public information about Ozzie Oct 9, 2018
README.md Updated CODEOWNERS with main maintainer and lead (#41) May 19, 2019
analysis_options.yaml
pubspec.yaml v2.2.3 -> Update Dart SDK and test version (#36) May 3, 2019

README.md

ozzie.flutter

Pub CircleCI codecov

ozzie icon art

Ozzie is your testing friend. Ozzie will take an screenshot during integration tests whenever you need. Ozzie will capture performance reports for you.

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.

If you want to measure the performance of your app, simple wrap your integration tests in profilePerformance and it will be added to the HTML report.

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.profilePerformance('counter0', () async {
      await driver.waitFor(find.text('0'));
      await ozzie.takeScreenshot('initial_counter_is_0');
    });
  });

  test('initial counter is 0', () async {
    await ozzie.profilePerformance('counter1', () async {
      await driver.tap(find.byType('FloatingActionButton'));
      await driver.waitFor(find.text('1'));
      await ozzie.takeScreenshot('counter_is_1');
    });
  });
}

After this, a report will be generated inside your project as ozzie/index.html:

report example

Using ozzie.yaml to control performance thresholds

You can declare, at the root of your project, an ozzie.yaml file to control the different thresholds of your performance tests. If this file is not declared, Ozzie will use internal default values:

ozzie.yaml:

integration_test_expectations:
  should_fail_build_on_warning: true
  should_fail_build_on_error: true
performance_metrics:
  missed_frames_threshold:
    warning_percentage: 5.0
    error_percentage: 10.0
  frame_build_rate_threshold:
    warning_time_in_millis: 14.0
    error_time_in_millis: 16.0
  frame_rasterizer_rate_threshold:
    warning_time_in_millis: 14.0
    error_time_in_millis: 16.0

Optional screenshots

Taking screenshots can take a while, and sometimes you might want to run your integration tests without taking screenshots. If that's the case, you can set shouldTakeScreenshots to false and skip that part, saving you some precious time:

setUpAll(() async {
  driver = await FlutterDriver.connect();
  ozzie = Ozzie.initWith(
    driver,
    groupName: 'counter',
    shouldTakeScreenshots: false,
  );
});

Maintainers

Project Lead(s):

Main Maintainer(s):

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.
You can’t perform that action at this time.