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.
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:
Strawberry Perl for Windows
Perl is a programming language suitable for writing simple scripts as well as complex applications - see…
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:
In your OS terminal from your flutter project subfolder you will type:
./genhtml.perl ./coverage/lcov.info -o coverage/html
And you will get a nice subfolder called metrics in your flutter project and the generated report looks something like this:
Keep in mind that it’s better combine this report along with the McCabe cycle metrics report on tests that I talk about in my McCabe cycles articles for a full effective code coverage picture.
Specific article resources:
General Flutter and Dart resources:
Google LLC owns the following trademarks; Dart, Flutter, Android, Roboto, Noto. Apple Inc owns the trademarks iOS, MacOSX, Swift, and ObjectiveC. Apple Inc owns trademarks to their fonts of SF Pro, Sf Compact, SF mono, and New York. JetBeans Inc owns the trademarks to JetBeans, IntelliJ, and Kotlin. Oracle Inc owns the Java trademark. Microsoft Inc owns the trademarks to MS Windows OS and Powershell. Gradle is a trademark of Gradle Inc. The Git Project owns the trademark to Git. Linux Foundation owns the trademark to Linux. SmartPhone OME’s own trademarks to their mobile phone product names. To the best of my ability I follow the brand and usage guidelines with the above mentioned trademarks.
About Fred Grott
I’m the crazy SOB who as a former android mobile developer is starting to write about flutter mobile app development, design, and life(see Eff COVID and GOP). Will I reach the pivotal One Million Medium monthly viewers mark? Sit-back and watch it happen. Find me on these social platforms:
Fred Grott - Android Software Engineer - Fred Grott
Berufserfahrung, Kontaktdaten, Portfolio und weitere Infos: Erfahr mehr - oder kontaktier Fred Grott direkt bei XING.
Fred Grott - CEO-CPO-Designer - GrottUX | LinkedIn
View Fred Grott's profile on LinkedIn, the world's largest professional community. Fred has 3 jobs listed on their…
fredgrott (Fred Grott) on Keybase
What the heck is Keybase? Keybase comes with everything you need to manage your identity, create secure chats, and…