junitreport 1.0.2

  • Readme
  • Changelog
  • Installing
  • 71

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

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

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:

  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';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.12.21


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.

Fix bin/tojunit.dart. (-6.31 points)

Analysis of bin/tojunit.dart reported 13 hints, including:

line 17 col 58: Unnecessary new keyword.

line 21 col 15: Unnecessary new keyword.

line 31 col 19: Unnecessary new keyword.

line 39 col 16: Unnecessary new keyword.

line 81 col 12: Unnecessary new keyword.

Fix lib/src/impl/xml.dart. (-3.93 points)

Analysis of lib/src/impl/xml.dart reported 8 hints, including:

line 8 col 10: Unnecessary new keyword.

line 9 col 5: Unnecessary new keyword.

line 17 col 10: Unnecessary new keyword.

line 21 col 5: Unnecessary new keyword.

line 23 col 29: Unnecessary new keyword.

Fix lib/src/impl/report.dart. (-2.96 points)

Analysis of lib/src/impl/report.dart reported 6 hints, including:

line 13 col 7: Unnecessary new keyword.

line 15 col 7: Unnecessary new keyword.

line 16 col 41: Unnecessary new keyword.

line 17 col 32: Unnecessary new keyword.

line 18 col 53: Avoid const keyword.

Fix lib/src/api/junitreport.dart. (-0.50 points)

Analysis of lib/src/api/junitreport.dart reported 1 hint:

line 10 col 12: Unnecessary new keyword.

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.


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.8
path 1.6.4
petitparser 2.4.0
typed_data 1.1.6
Dev dependencies
test any