I did flutter test --coverage
A lcov.info
was generated under coverage
I want to convert this into html but I don't find a tool for Windows.
On linux, you just do:
sudo apt-get update -qq -y
sudo apt-get install lcov -y
Then you do
genhtml coverage/lcov.info -o coverage/html
I am on Windows and
'genhtml' is not recognized as an internal or external command,
operable program or batch file.
Ok I found it. I will leave the anwser here in case it maybe helpful for anyone.
Actually genhtml is a perl
script. If you are have git bash installed, you should have perl already. Try where perl
on the cmd
and it will show you the path.
For me it was at C:\Program Files\Git\usr\bin\perl.exe
Now create a file called genhtml.perl
inside your flutter project root directory. (Make sure to .gitignore
it)
Then in the file, copy and paste the content this https://raw.githubusercontent.com/valbok/lcov/master/genhtml.perl
Finally open git bash and run $ ./genhtml.perl ./coverage/lcov.info -o coverage/html
.
Check You are done html files at coverage/html
.
On android studio, select index.html
then CTRL+SHIFT+C
to copy the file path.
Open Chrome and on the url bar add file:///
+CTRL+V
. Tap enter. You are done.
PS : Who so ever is facing an error like No common filename prefix found!
or some other issue, they can try replacing content of genhtml.perl
file from below link.
https://raw.githubusercontent.com/linux-test-project/lcov/master/bin/genhtml