Open abarth opened 7 years ago
See https://github.com/angular/angular-cli/issues/3560#issuecomment-270141272 for possible inspiration.
IntelliJ already supports "Run with coverage" for Dart and renders executed code with different background colors and also shows coverage percentage besides each file in the Project window. Would be great to have that in Flutter.
A small limitation in the IntelliJ Dart coverage support is, that it doesn't support pub test
, but only pub run
, this means there needs to be a test/all_tests.dart
file that imports all ..._test.dart
files and calls their main()
I was able to visualize with this in VS Code https://github.com/ryanluker/vscode-coverage-gutters
It's a shame this feature is not available for flutter, in spite of plain dart being supported for a long time now.
/cc @devoncarew
Running into this while trying to visualize coverage in a pending PR.
There is a coverage option in Android Studio and IntelliJ that I usually use that will add for each line the information of the lcov file. That works amazingly good in react and other JS libraries.
Does someone knows where to begin, I would love to take a look at how to implement that solution?
is there any update on on a coverage visualization plugin for Flutter?
I just found https://github.com/marius-h/flutter_enhancement_suite which has support for running flutter tests with coverage and visualizes the lcov.info. (Only the 1.4.0 Version is in the Jetbrains Plugin Repo, but the Feature was added with 1.5.0 which was released just a few hours ago, so until the update is approved by jetbrains you have to install the plugin manually from the github release page)
@maximilianmaihoefner I'm pretty sure the update will be available on Monday :) Let me know if the feature works for you or if you encountered any issues
This issue can be closed as soon as Jetbrains approves the update. The solution for the problem is to use the Flutter Enhancement Suite of @marius-h.
After the installation, you are able to let your tests run with coverage and get the coverage visible inside of your IDE.
You can find the plugin in Android Studio Plugins -> Marketplace -> Search for "Flutter Enhancement Suite" -> Download and Restart. Or via the Plugin Page.
Updated - reduced the image sizes to make it easier readable.
Part 1 is fixed in #5463. Not sure when we'll get to part 2, so keeping this open.
Any progress on this? Visualizing the coverage would be super helpful.
@GroovinChip can you be more specific?
@stevemessick yes, being able to view the coverage in the line gutters would be quite helpful. Currently I have to manually generate HTML out of my lcov.info and view it in the browser to view highlights. This highlights whole lines, though, not the gutters. Having red/green lines in the line gutters would be really helpful.
Additionally, having a percentage of lines covered showing on filenames would be very helpful.
Red/green highlighting is supported as of #5463. You need to run the tests from IntelliJ using the "run with coverage" button, but after that everything should be automatically displayed. Make sure you have the latest plugin and give that a try. If you run into problems, I suggest opening a new issue, as this one is now just tracking the second request.
And, your second paragraph echoes the second request. We're working on a table view of percentages. It got side-lined due to re-prioritization but will eventually be implemented.
You need to run the tests from IntelliJ using the "run with coverage" button, but after that everything should be automatically displayed
I have been doing this
Make sure you have the latest plugin and give that a try
I do have the latest plugin, the one released today
Flutter Enhancement Suite dropped coverage support.
The
flutter test --coverage
command produces ancoverage/lcov.info
file that contains information about the line coverage of your tests. We should be able to visualize that information in IntelliJ.When editing a file, you should be able to see whether a line was (a) executed in a test, (b) possible to execute but not actually executed, (c) not actually possible to execute. (All this data is in the lcov file.)
There should be some sort of overview panel that lists the various files in the project and what percent line coverage they have. Also, there should be an overall readout for the percent coverage of the whole project.
For example, the lcov-info plugin does this for Atom. It's likely that such a plugin already exists for IntelliJ. We might simply need to find it and recommend.