flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.98k stars 319 forks source link

Cannot visualize lcov coverage data #718

Open abarth opened 7 years ago

abarth commented 7 years ago

The flutter test --coverage command produces an coverage/lcov.info file that contains information about the line coverage of your tests. We should be able to visualize that information in IntelliJ.

  1. 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.)

  2. 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.

eseidel commented 7 years ago

See https://github.com/angular/angular-cli/issues/3560#issuecomment-270141272 for possible inspiration.

zoechi commented 6 years ago

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()

MisterJimson commented 5 years ago

I was able to visualize with this in VS Code https://github.com/ryanluker/vscode-coverage-gutters

Lootwig commented 5 years ago

It's a shame this feature is not available for flutter, in spite of plain dart being supported for a long time now.

tvolkert commented 5 years ago

/cc @devoncarew

Running into this while trying to visualize coverage in a pending PR.

md-weber commented 3 years ago

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.

grafik

Does someone knows where to begin, I would love to take a look at how to implement that solution?

yulkin2002 commented 3 years ago

is there any update on on a coverage visualization plugin for Flutter?

maximilianmaihoefner commented 3 years ago

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)

marius-h commented 3 years ago

@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

md-weber commented 3 years ago

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.

Usage

After the installation, you are able to let your tests run with coverage and get the coverage visible inside of your IDE.

Install before the update is approved:

  1. Download the Plugin 1.5.0 in the release section
  2. In Android Studio / IntelliJ navigate to the Plugins section
  3. Select the gear icon and choose the Install plugin from the disk
  4. Select the zip file

Install after the update

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.

stevemessick commented 3 years ago

Part 1 is fixed in #5463. Not sure when we'll get to part 2, so keeping this open.

GroovinChip commented 3 years ago

Any progress on this? Visualizing the coverage would be super helpful.

stevemessick commented 3 years ago

@GroovinChip can you be more specific?

GroovinChip commented 3 years ago

@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.

stevemessick commented 3 years ago

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.

GroovinChip commented 3 years ago

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

cedric-booxi commented 2 years ago

Flutter Enhancement Suite dropped coverage support.