Member-only story

Getting Real Code Coverage

Fred Grott
3 min readFeb 8, 2021

--

It’s not enough just to type flutter test — coverage as it leaves out how to get the actual fancy html metrics report generated. Let me show you an easy to do exactly that for your flutter project.

lcov and You

Lcov on most unix systems computes code coverage on unit tests. While in our Flutter projects we can get the lcov file generated, it seems that Android Studio can not view it.

Let me show you an easy way to generate the HTML report so that you can actually view the report in Android Studio.

Pre-Requirements

You need two things for this to work. First, you install Perl. Those on MS Windows, you can install the strawberry perl distribution of Perl at:

Make sure to add the perl executable to your path settings.

The second requirement is you need Peter Oberparleiter’s(that VaL Doroshchuk ported to windows) perl script to generate the html metrics report which you can find at:

--

--

Fred Grott
Fred Grott

No responses yet