Repository navigation
Flutter Test should support multiple reporters #69425
Description
Activity
- addeda: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to FluttertoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
on Nov 2, 2020 is there something on the market that can be used instead?
Dart supports the --file-reporter option: https://github.com/dart-lang/test/blob/master/pkgs/test/doc/json_reporter.md#usage
It would be nice if flutter supported that too.
Reacted by maBarabas and Mateus Felipe C. C. PintoReacted by Daniel Varga-Hali and Tyrone Meijn- added a commit that references this issue
on Sep 20, 2022 flutter testdoes have a--reporterargument, which acceptscompact,expanded, andjson. Is this what you're looking for?flutter testdoes have a--reporterargument, which acceptscompact,expanded, andjson. Is this what you're looking for?The main goal is outputting to more than one reporter at the same time. So JSON + expanded in a single run.
Optionally, allow custom reporters, for developing plugins for jUnit XML, ...
Reacted by David Frankl- added a commit that references this issue
on Feb 21, 2023 This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Mar 7, 2023 - addedP3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectand removed
on Jun 28, 2023
Use case
When running
flutter teston a CI, output is very verbose and hard to follow:(this goes on for 200+ lines)
The current alternative is to output to json with
flutter test --machine. This is even more verbose, but can be converted to JUnit XML so we can use a specialized test visualization tools, such as Bitrise Test Reports.This does the job, but requires a lot of configuration and there is currently no way of having two reporters at the same time.
If I want both CLI output and JSON, I need to run tests twice.
I want to be able to output to any format while still having a console output (customizable as well).
Proposal
Flutter should have a
--reporterCLI option, inspired by Mocha Reporters or Jest Reporters.By default Flutter will use the current reporter. If env
CI=true, flutter will usespecautomatically.This is an idea we can take from the very well established and mature JS ecosystem.