Questions tagged [devel-cover]

Devel::Cover - Code coverage metrics for Perl

Devel::Cover - Code coverage metrics for Perl

This module provides code coverage metrics for Perl. Code coverage metrics describe how thoroughly tests exercise code. By using Devel::Cover you can discover areas of code not exercised by your tests and determine which tests to create to increase coverage. Code coverage can be considered an indirect measure of quality.

Quick start for Devel::Cover

33 questions
2
votes
1 answer

How to tell Perl's Devel::Cover that a Readonly value can never be false?

I have this module which has a Readonly constant for a default value that is used if the caller does not specify a value. package Mcve; use strict; use warnings; use Readonly; Readonly our $CONST => 123; sub new { my ($class, %args) = @_; …
Robert
  • 7,394
  • 40
  • 45
  • 64
2
votes
1 answer

Devel::Cover - Save coverage data before the program ends

Question: Can I force Devel::Cover to dump/save coverage data within the code, e.g. cover->dump_coverage(), before the program terminates? Context: I want to extract coverage reports even if I forcefully end the Perl process with kill -9, to which…
delirium
  • 868
  • 6
  • 20
2
votes
1 answer

In Devel::CoverReport::DB what does .12 and .13 format means?

I am generating coverage using "Devel::Cover" cpan module, which generates cover_db and has a runs subdirecoty inside. Inside run directory i am getting the file cover.14. How to get .12 or .13 format file and what does this .12, .13 or .14 format…
2
votes
1 answer

Devel::Cover Branch coverage on conditional ternary operator

I'm running cover from Devel::Cover on a module and getting 50% of branch coverage in lines that use the conditional ternary operator i.e. return @rgb ? map { hex $_ } @rgb : undef; Is this OK? Do I have to change the code to use if/else blocks in…
quicoju
  • 1,661
  • 11
  • 15
2
votes
1 answer

What do the columns in Perl's Devel::Cover output mean?

In the "Perl build, unit testing, code coverage: A complete working example by Kurt W. Leucht" we see that we run build testcover and bet the coverage report. We see the result in the figure "File Cover". Can anyone tell what does the number shown…
Shwetha
  • 37
  • 1
2
votes
1 answer

How do I change the default Module::Build / Test::More directory from "lib" to something else?

Using the directory and file architecture in this Post on Perl Unit testing and Code Coverage (which btw was VERY helpful), I copied the files I'll be running unit tests and code coverage on into a new "lib" directory and it works like a…
2
votes
0 answers

Devel::Cover not collecting any data after startup with mod_perl2

I want to check Selenium's coverage of my web app, which runs on mod_perl2 on CentOS 6.5. So I installed Devel::Cover, put use Devel::Cover; in my httpd.conf's section, and restarted Apache. It immediately writes some coverage data from my…
Kev
  • 15,899
  • 15
  • 79
  • 112
1
vote
1 answer

Devel::Cover - only subroutine coverage

I want only subroutine coverage in my perl file. So in main file I inserted the following statement: mainfile.pl use Devel::Cover::Subroutine; If I run mainfile.pl it shows the error: Devel::Cover: Writing coverage database to…
crusader
  • 11
  • 2
1
vote
2 answers

Is there a need or how to write a test on main.pl which is not module and run it using Perl Devel cover

There are lots of material talking about writing coverage on module but how if I want to write a test for command runnable perl script (main.pl)? Is there a need to write test for main.pl or I just need to write test for module will do? Let's say I…
Woo Zhan Wei
  • 15
  • 1
  • 4
1
vote
1 answer

Using Devel-Cover to get coverage reports

I am new to Perl and I am trying to generate a coverage report for a Perl script I had. I followed the steps mentioned here to install Devel-Cover https://code.activestate.com/ppm/Devel-Cover/ and ran perl -MDevel::Cover script I get some coverage…
Merolla
  • 315
  • 2
  • 10
1
vote
0 answers

Devel::Cover - Impossible to mark branch as uncoverable

I'm honestly not sure if this is a bug or me missing something. Devel::Cover ignores my # uncoverable branch true based on a previous condition somehow. I have 2 files - Test and Test2 - the uncoverable is in Test. Now when the trigger condition…
lukash
  • 725
  • 6
  • 19
1
vote
1 answer

Catalyst + mod_perl + selenium: how to Devel::Cover?

I have a web application with lots of tests. I am currently only using Devel::Cover for coverage reports of my unit tests, but would also like coverage reports of my front-end Selenium tests. I have tried 'use Devel::Cover' in my app psgi startup…
Mauritz Hansen
  • 4,674
  • 3
  • 29
  • 34
1
vote
0 answers

Perl Devel::Cover to test (cover) my_file.pl with different command line input arguments

I am a newbie and pardon my ignorance. I am trying to use Devel::Cover (DC) to get an idea of the code coverage of my my_file.pl Perf file ran with arg1, arg2 as command-line input arguments. I am using Perl 5.8.9 with DC 1.23. The steps I executed…
Tito
  • 11
  • 1
1
vote
0 answers

Filtering the directory out with Devel::Cover

I wanted to get coverage of my Perl based application in CentOS with apache web server, and went for the Devel::Cover to get it done. After some initial struggles, I got it installed. Since the PERL5OPT env variable did not help me in getting the…
Prasanth R
  • 11
  • 1
0
votes
1 answer

How to provide @INC for cover script as part of Devel::Cover

How do I provide @INC externally for the cover script that is part of the Devel::Cover module. I want cover script to run by searching for libraries relative to where it is triggered. Idea is to have cover as part of source, and whoever gets this…
Girish
  • 45
  • 5