TOPdesk / dart-junitreport

An application to generate JUnit XML reports from dart test runs.
https://pub.dartlang.org/packages/junitreport
MIT License
31 stars 45 forks source link

running for flutter tests #11

Closed dougdonohoe closed 6 years ago

dougdonohoe commented 6 years ago

Do you have an example of using this for flutter tests?

I've tried flutter pub pub run test --reporter json | tojunit but running tests this way doesn't seem to work as flutter test does. I get errors like this:

 <error message="Failed to load foo_test.dart Unable to spawn isolate: dart:ui:1: Error: 
Not found: dart:ui.">dart:isolate/runtime/libisolate_patch.dart 457:14  Isolate.spawnUri

Before I dig further, wondering if you have a working example for flutter project.

I'm hoping to use this library to do builds in Bamboo. Thanks!

rspilker commented 6 years ago

As far as I can see, it is not possible to use --reporter in flutter test, and flutter pub test --help informs us that dart:ui will not be available:

Run the "test" package.
This is similar to "flutter test", but instead of hosting the tests in the
flutter environment it hosts the tests in a pure Dart environment. The main
differences are that the "dart:ui" library is not available and that tests
run faster. This is helpful for testing libraries that do not depend on any
packages from the Flutter SDK. It is equivalent to "pub run test".
dougdonohoe commented 6 years ago

Have you or anyone else looked at capturing test output from flutter test in a manner that could be integrated with CI tools like Jenkins/Bamboo? That's how I stumbled upon this library. Any pointers would be appreciated.

On a side note, we might want to drop the "Flutter" tag up at pub since this really isn't useable for a flutter project.

dougdonohoe commented 6 years ago

This actually seems to work:

flutter test --machine | tojunit

rspilker commented 6 years ago

Great find! I'll add it to the README

dougdonohoe commented 6 years ago

Thanks - I've actually got this working on Bamboo quite nicely. Your library is working great!

dougdonohoe commented 6 years ago

FYI, I wrote up how we used junitreport to run on flutter.