testreport 1.0.0

Test Report #

Introduction #

This library can be used to process the results of dart tests.

The goal of this library is to process the data from the json output emitted by the dart test runner and provide an API to the interpreted test results.

Purpose #

By running

pub run test simple_test.dart --reporter json

and the contents of simple_test.dart is

import 'package:test/test.dart';

main() {
  test('simple', () {
    expect(true, true);
  });
}

the dart test runner will output the results of the test in json format as a stream of events:

{"protocolVersion":"0.1.0","runnerVersion":"0.12.13+1","type":"start","time":0}
{"count":1,"type":"allSuites","time":0}
{"suite":{"id":0,"platform":"vm","path":"simple_test.dart"},"type":"suite","time":0}
{"test":{"id":1,"name":"loading simple_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null}},"type":"testStart","time":0}
{"testID":1,"result":"success","hidden":true,"type":"testDone","time":237}
{"group":{"id":2,"suiteID":0,"parentID":null,"name":null,"metadata":{"skip":false,"skipReason":null},"testCount":1},"type":"group","time":241}
{"test":{"id":3,"name":"simple","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null}},"type":"testStart","time":242}
{"testID":3,"result":"success","hidden":false,"type":"testDone","time":268}
{"success":true,"type":"done","time":271}

From this json output, it is not easy to see how many tests were executed, how many failed and how much time was spent in each test.

The Processor in this project takes the json events, and turns them into a Report, that is suitable for further processing.

License and contributors #

1.0.0 #

  • drop support for Dart 1.x

0.3.1 #

  • dart 2.0 support

0.3.0 #

  • remove dependency on built_collection

0.2.0 #

  • moved part files to src/api and implementation files to src/impl

0.1.0 #

  • Initial implementation

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  testreport: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:testreport/testreport.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
27
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Sep 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:testreport/testreport.dart.

Health issues and suggestions

Document public APIs. (-1 points)

33 out of 33 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/impl/processor1.dart. (-0.50 points)

Analysis of lib/src/impl/processor1.dart reported 1 hint:

line 35 col 11: DO use curly braces for all flow control structures.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and testreport.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
test any