testreport 1.2.0 copy "testreport: ^1.2.0" to clipboard
testreport: ^1.2.0 copied to clipboard

outdated

This library can be used to process the results of dart tests. It processes data from the `json` output emitted by the dart test runner and provide an API to the test results.

example/example.dart

import 'dart:io';
import 'dart:convert';

import 'package:testreport/testreport.dart';

void main(List<String> args) async {
  var file = File(args[0]);
  var lines = LineSplitter().bind(utf8.decoder.bind(file.openRead()));
  var report = await createReport(file.lastModifiedSync(), lines);

  report.suites.forEach((s) {
    s.problems.forEach((t) {
      t.problems.forEach((p) {
        print('${s.path} - ${t.name}: ${p.message}');
      });
    });
  });
}

Future<Report> createReport(DateTime when, Stream<String> lines) async {
  var processor = Processor(timestamp: when);
  await for (String line in lines) {
    processor.process(json.decode(line) as Map<String, dynamic>);
  }
  return processor.report;
}
3
likes
40
points
162k
downloads

Publisher

unverified uploader

Weekly Downloads

This library can be used to process the results of dart tests. It processes data from the `json` output emitted by the dart test runner and provide an API to the test results.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on testreport