Enthusiast
Enthusiast

Reputation: 95

Not able to generate the code coverage result using Devel::Cover

I tried to find code coverage for a c4rgr.pl test file with Devel::Cover. I have a .pm module sitting in the same area. I am using perl -MDevel::Cover c4rgr.pl, which generates a cover_db and has a runs subdirectory inside.

Inside the runs subdirectory, a versionated directory is created every time I run the Cover command and a cover.13 is obtained. This cover.13 file (I think) has the raw data for code coverage results.

Still, I am unable to get the test results in a HTML output format or on the Terminal screen.

This is what I do:

  1. Run the perl -MDevel::Cover c4rgr.pl

    Here, the c4rgr.pl uses a .pm module which is sitting in the same area.

  2. When I run above command, it runs the test file but no test coverage output as shown in Devel::Cover HTML output is obtained. Nevertheless, the cover.13 file is created every time.

    Cover.13 <- 1401378982.24872.12631 <- runs <- cover_db .

  3. Can someone tell me how to get the HTML file, please? I was able to run a dummy test with the same features and generate a HTML file. But with my actual test, it does not. Or is there a way to convert the cover.13 file to HTML that is not being done in my case?

Upvotes: 5

Views: 844

Answers (2)

AMAN SAURAV
AMAN SAURAV

Reputation: 19

If @toolic solution is not working, you can also try this. Go to terminal and

setenv PERL5OPT "-MDevel::Cover"
perl script_name.pl
unsetenv PERL5OPT
cover -report html (or json if you need)

This solution works very fine. Note: Run all these in the terminal.

Upvotes: 0

toolic
toolic

Reputation: 62236

After running perl -MDevel::Cover c4rgr.pl, run the cover command. For example:

cover -report html -outputdir cover_report

Upvotes: 6

Related Questions