flutter-intellij: Cannot visualize lcov coverage data

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, © 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.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 101
  • Comments: 17 (4 by maintainers)

Most upvoted comments

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

/cc @devoncarew

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

Flutter Enhancement Suite dropped coverage support.

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)

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

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.

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.