dart_dot_reporter 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 55

Dot reporter for Dart/Flutter tests #

pub package

Provided to make short and readable test report for your Dart/Flutter projects.

Inspired by dot-reporter.

Sample output:

Best view for CI results review. :)

Installation #

If you want to use Dot reporter on the command line, install it using pub global activate:

pub global activate dart_dot_reporter
# Add $HOME/.pub-cache/bin to your PATH

or

flutter pub global activate dart_dot_reporter

To update it, use the same pub global activate command.

Usage #

At first you need to use machine readable reporter, here is example for Dart and Flutter.

Dart #

pub run test --reporter=json > machine.log || echo 'Tests failed'
dart_dot_reporter machine.log

Flutter #

flutter test --machine > machine.log || echo 'Tests failed'
flutter pub global run dart_dot_reporter machine.log

Arguments #

dart_dot_reporter <machine.log> [flags]

NOTE: Path to log file is required as first argument.

You can use one of next flags after path:

FlagDescription
-hTo get help. More info can be found on GitHub.
--hide-skipTo hide output about skipped tests.
--show-successTo show output about successfull tests.
--show-idTo show id of the test from Machine log.
--show-messageTo show error message of the failed test.
--no-colorTo disable colors.
--fail-skippedReturn exit code 1 if has skipped tests.

Known issues #

  • If test starts with 'loading /' it will be skipped in report.

TODO: #

  • Count time of execution, and display most slow tests
  • Support tool run as a pipe like pub run test --reporter=json | dart_dot_reporter

Development #

Run the app using dart bin/dart_dot_reporter.dart.


Created from templates made available by Stagehand under a BSD-style license.

1.0.3 #

  • Add option to fail job if has skipped tests

1.0.2 #

  • Fix global executable name

1.0.1 #

  • Configure CI

1.0.0 #

  • Initial version
  • Allow to hide skipped tests
  • Allow to show success tests
  • Allow to show machine ID of the test
  • Allow to show error message of failed tests (it does not have any stacktrace)
  • Allow to disable colors

example/README.md

Example #

Before #

Such error log can be 10000 lines long.

00:01 +1 -1: test/dart_dot_reporter_test.dart: parser can parse file with lines containing json [E]
  Expected: TestModel:<TestModel { 29 State.Failure API update Expected: {
                        'id': 103                      }
              Actual: {
                        'ids': 102,
                      }
               Which: is missing map key 'id'
             }>
    Actual: TestModel:<TestModel { 29 State.Failure API update  Expected: {
                        'id': 103
                      }
              Actual: {
                        'ids': 102,
                      }
               Which: is missing map key 'id'
             }>

  package:test_api                       expect
  test/dart_dot_reporter_test.dart 37:7  main.<fn>.<fn>

00:01 +1 -2: test/dart_dot_reporter_test.dart: dot_reporter Ignore "loading" tests [E]
  Expected: <2>
    Actual: <5>
  Unexpected number of calls

  package:test_api                         expect
  package:mockito/src/mock.dart 866:5      VerificationResult.called
  test/dart_dot_reporter_test.dart 106:29  main.<fn>.<fn>

After #

.XX

X parser can parse file with lines containing json
X dot_reporter Ignore "loading" tests

Total: 3
Success: 1
Skipped: 0
Failure: 2

After with color #

After with flags enabled #

dart_dot_reporter machine.log --show-message --show-success --show-id

.!XX

27 . API getAll
28 ! API delete
29 X API update
  Expected: {
            'id': 103
          }
  Actual: {
            'ids': 102,
          }
  Which: is missing map key 'id'

31 X API too big print text

Total: 4
Success: 1
Skipped: 1
Failure: 2

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate dart_dot_reporter

2. Use it

The package has the following executables:


$ dart_dot_reporter

Use this package as a library

1. Depend on it

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


dependencies:
  dart_dot_reporter: ^1.0.3

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:dart_dot_reporter/dart_dot_reporter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
11
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

We analyzed this package on Apr 4, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

42 out of 42 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
Dev dependencies
mockito ^4.1.0
pedantic ^1.8.0
test ^1.6.0