GithubHelp home page GithubHelp logo

betterment / better_test_reporter Goto Github PK

View Code? Open in Web Editor NEW
8.0 9.0 0.0 92 KB

Tooling and libraries for processing dart test output into dev-friendly formats

Home Page: https://pub.dev/packages/better_test_reporter

License: Other

Dart 99.24% Shell 0.76%
dart flutter testing-tools

better_test_reporter's Introduction

better_test_reporter

pub package Build status License: MIT Maintenance

Introduction

This is an application/library heavily inspired by dart-junitreport and dart-testreport. It takes what was done in those two packages and brings them under a single umbrella, updates to null-safety, and makes various code style improvements.

The purpose of this package is three-fold:

  • Firstly, it provides models by which output from the test json reporter can be decoded.
  • Secondly, it provides a processor that will take a full json report from the test json reporter and generate a more developer-friendly report model structure that is agnostic to the protocol version of the test json reporter.
  • Thirdly, it is a command-line application(report_to_junit) that can be used to take in a full json report from the test json reporter and generate a junit XML report(usable by many CI tools)

Experimental nature

This package is still experimental as we continue to build out more functionality. It's current state is barebones as we investigate ways to make the junit output more useful and ways to produce better testing reports for use outside of just junit.

Getting Started

In order to start using the report_to_junit command, install the latest better_test_reporter as a global package via pub.dev.

pub global activate better_test_reporter

Options

Details on all options for report_to_junit can be found by running report_to_junit --help

> report_to_junit --help
-i, --input        the path to the 'json' file containing the output of 'pub run test'.
                   if missing, <stdin> will be used
-o, --output       the path of the to be generated junit xml file.
                   if missing, <stdout> will be used
-b, --base         the part to strip from the 'path' elements in the source
                   (defaults to the current working directory)
-p, --package      the part to prepend to the 'path' elements in the source
                   (defaults to "")
-t, --timestamp    the timestamp to be used in the report
                   - 'now' will use the current date/time
                   - 'none' will suppress timestamps altogether
                   - a date formatted 'yyyy-MM-ddThh:mm:ss' will be used as UTC date/time
                   - if no value is provided
                       - if '--input' is specified the file modification date/time is used
                       - otherwise the current date/time is used
-h, --help         display this help text

Misc

Differences from original implementation in dart-junitreport and dart-testreport

  1. When generating the XML for a problem during a test, dart-junitreport had a special case for only one problem occurred. The multiple problem case also handled the case for a single problem. We found the special case for a single problem unneeded and a little buggy, so it was removed in better_test_reporter.
  2. When parsing the test reporter json into a report, dart-testreport set tests as not hidden if they encountered any problems while running. In better_test_reporter, the hidden attribute on a test will be purely based on whether the test was explicitly hidden based on the TestDoneEvent json. That said, we maintained the hidden behavior for the output junit xml by shifting that decision out of the report and up to whatever consumes the report.
  3. When generating the XML for a test case, better_test_reporter defaults to stripping the current working directory out of the classname.

better_test_reporter's People

Contributors

celticmajora avatar samandmoore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

better_test_reporter's Issues

Add repo about

Describe the solution you'd like
Just needs a one sentence summary of what this project is about

Split out application package and library package

Is your feature request related to a problem? Please describe.
Right now, better_test_reporter acts as both an application package and a library package. According to the dart docs, these are meant to be split apart into two separate packages.

Describe the solution you'd like
This could be done in a this same repo by making it a monorepo for two packages, one for the application and one for the libraries. This would keep all the code in one place as the two are heavily related anyway.

Describe alternatives you've considered
This could also be split out into two entirely separate repos, but I don't think that is necessary.

Additional context
In order to migrate safely, the application package would need to remain named better_test_reporter, but then the other package could be named whatever. We'd need to have a changelog note for better_test_reporter whenever the split is to point any users to the new package if they were previously depending on better_test_reporter as a library.

Pub score lowered by generated code

Describe the bug
Pana is analyzing the package and coming across analyzer violations in our generated code.

To Reproduce

run the following

dart pub global activate pana
pana

Expected behavior
Our generated code should not be opposing the dart analyzer in a way that deducts our pub score

CI improvements

Stretch goals:

  • See if there is pretty way to display test output using junit xml ๐Ÿ˜‰
  • Report coverage in some way

Fix LICENSE to recognize MIT

Is your feature request related to a problem? Please describe.
Right now, the license is not recognized as MIT due to us including references to licenses of code we adapted this package off of

Describe the solution you'd like
Figure out how github determines license and restructure file to fit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.