junitreport 1.0.2

JUnit Report #

Introduction #

This application can be used to convert the results of dart tests to JUnit xml reports. These XML reports can then be used by other tools like Jenkins CI.

By running

pub run test simple_test.dart --reporter json > example.jsonl
pub global run junitreport:tojunit --input example.jsonl --output TEST-report.xml

and the contents of simple_test.dart is

import 'package:test/test.dart';

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

this program will generate 'TEST-report.xml' containing

<testsuites>
  <testsuite errors="0" failures="0" tests="1" skipped="0" name="simple" timestamp="2016-05-22T21:20:08">
    <properties>
      <property name="platform" value="vm" />
    </properties>
    <testcase classname="simple" name="simple" time="0.026" />
  </testsuite>
</testsuites>

For transforming Flutter tests reports, instead of passing --reporter json, you need to use --machine.

Installation #

Run pub global activate junitreport to download the program and make a launch script available: <dart-cache>/bin/tojunit.

If the <dart-cache>/bin directory is not on your path, you will get a warning, including tips on how to fix it.

Once the directory is on your path, tojunit --help should be able to run and produce the program help.

Then you can also use the example above much simpler:

pub run test simple_test.dart --reporter json | tojunit

And to run all tests for Flutter:

flutter test --machine | tojunit

License and contributors #

1.0.2 #

  • updated dependencies:
    • intl: '^0.15.8'
    • args: '^1.5.2'

1.0.1 #

  • updated dependencies:
    • xml: '^3.3.1'
    • intl: '^0.15.7'
    • testreport: '^1.0.0'
    • args: '^1.5.1'

1.0.0 #

  • force Dart 2.1+
  • update dependency xml: '^3.3.0', fix problem with pretty printer

0.3.3 #

  • more dart 2.0 support

0.3.2 #

  • updated dependencies:
    • testreport: '^0.3.1'

0.3.1 #

  • support for Dart 2.0
  • updated dependencies:
    • xml: '^3.0.0'
    • intl: '^0.15.5'
    • args: '^1.4.4'

0.3.0 #

  • updated dependencies:
    • sdk: '>=1.19.0 <2.0.0'
    • xml: '^2.6.0'
    • intl: '^0.15.0'
    • testreport: '^0.3.0'
  • removed transitive dependencies on 'build_collection' and 'quiver'

0.2.1 #

  • restrict dependency on xml to '>= 2.5.0 <2.6.0' because the XmlPrettyWriter moved to a different library
  • use one system-out element to contain all outputs instead of one per output

0.1.0 #

  • Initial implementation

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate junitreport

2. Use it

The package has the following executables:


$ tojunit

Use this package as a library

1. Depend on it

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


dependencies:
  junitreport: ^1.0.2

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:junitreport/junitreport.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
62
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]
77
Learn more about scoring.

We analyzed this package on Sep 19, 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:junitreport/junitreport.dart.

Health issues and suggestions

Document public APIs. (-1 points)

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

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (intl).

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 junitreport.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
args ^1.5.2 1.5.2
intl ^0.15.8 0.15.8 0.16.0
testreport ^1.0.0 1.0.0
xml ^3.3.1 3.5.0
Transitive dependencies
charcode 1.1.2
collection 1.14.12
convert 2.1.1
meta 1.1.7
path 1.6.4
petitparser 2.4.0
typed_data 1.1.6
Dev dependencies
test any