Reputation: 20426
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.
Upvotes: 13
Views: 8967
Reputation: 8008
%programdata%\chocolatey\lib\lcov\tools\bin\genhtml
C:\Strawberry\perl\bin\perl.exe
perl.exe myGenhtml.perl MyInput.lcov -o myOutputDirPath
myGenhtml.perl which is a file you can copy and use directly, or modify some of the parameters inside it.
<myOutputDirPath>/index.html
to see the result.Here is a script writing with Powershell that may help you run.
Upvotes: 2
Reputation: 51
set genhtml
variable to where the genthml perl script of lcov located to PATH
for me, it's on
C:\ProgramData\chocolatey\lib\lcov\tools\bin
then run the command
genhtml coverage/lcov.info -o coverage/html
from git bash instead of terminal
-o
is shorthand for --output-file
see this article
Upvotes: 4
Reputation: 20426
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
Upvotes: 23