test_report_parser

Dartle CI pub package

This library contains an auto-generated Dart Model representing the events emitted by the Dart Tests JSON reporter.

It can be used to parse the Dart Test JSON report into typed Dart objects for further processing.

The model is generated by parsing the json_reporter.md page, which documents the Dart Test JSON reporter output.

Using test_report_parser

Add test_report_parser to your pubspec dependencies:

dependencies:
  test_report_parser: ^1.1.0

Basically, call the function parseJsonToEvent(String) for each line of output from the JSON Test Reporter:

import 'package:test_report_parser/test_report_parser.dart';

void main() {
  final event = parseJsonToEvent('{"success":true,"type":"done","time":36361}');
  print(event);

  if (event is DoneEvent) {
    if (event.success) {
      print('!!!!!! Tests were successful !!!!!!');
    } else {
      print('XXXXXX There were failures. XXXXXX');
    }
  }
}

Check test_report_parser_example.dart for a full example.

See also the generated Dart Model.

Building

This project relies on Dartle to run the build.

If you have dartle installed, run dartle generate at the project root directory to generate the model locally, then run dartle to run the complete build.

Otherwise, run the build using dart as following:

dart pub get
dart dartle.dart generate

# Run a full build using Dartle
dart dartle.dart

# Run tests only
dart run test

Libraries

test_report_parser
This library contains an auto-generated Dart Model representing the events emitted by the Dart Tests JSON reporter.