There is a very good tool called LCOV which consists of: lcov and geninfo which provide a file with code coverage data and genhtml which transforms the coverage file to set of html files.
The problem is that these scripts are written for Linux environment and use Perl.
To run them on windows it is needed to:
- Install Perl (preferably under C:\Perl)
- Associate perl scripts with perl - very important is not to use windows association but to use commands:
assoc .perl=Perl.File
ftype Perl.File=C:\Perl\bin\perl.exe "%1" %*
After associating files under windows the arguments are not passed? - Download of the modified script available here.
After finishing these steps it is possible to invoke perl scripts by simply using windows command line and typing for example:
C:\Perl\bin\Perl.exe lcov.perl --capture --directory Debug --output-file debug/coverage.info --rc lcov_branch_coverage=1in order to generate file with code coverage and typing:
C:\Perl\bin\Perl.exe genhtml.perl --output HTML debug/coverage.info --demangle-cpp --prefix %~dp0 --function-coverage --branch-coverage --show-detailsto generate html reports.
Nice to read this article will be very helpful in the future, share more info with us. Good job! responsive web development
ReplyDeleteExcellent it works perfectly, thanks a lot for publishing that!
ReplyDeletesome tips please, it doesnt work for me, first i got errors referring the PWD, which I corrected with getcwd(), but then the errors keep coming and coming.
ReplyDeleteFixed by following these step : https://perlmaven.com/current-working-directory
ReplyDeleteI fixed it running on Windows 10 OS running perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x86-multi-thread
How did you fix it? Could you explain more detail
Delete