Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: XML::Lenient - my first CPAN module

by toolic (Bishop)
on Jun 16, 2016 at 12:44 UTC ( [id://1165847]=note: print w/replies, xml ) Need Help??


in reply to XML::Lenient - my first CPAN module

The Kwalitee link on the metacpan page points out that you should add a "Changes" file.

Did you measure coverage? I don't see any results on http://cpancover.com/latest/dist/X.html yet (I think results get posted there automatically these days).

  • Comment on Re: XML::Lenient - my first CPAN module

Replies are listed 'Best First'.
Re^2: XML::Lenient - my first CPAN module
by davies (Prior) on Jun 16, 2016 at 14:02 UTC

    Changes: Thanks, I'll look into that. Obviously there aren't any changes yet, but I usually put a changes section into my documentation. I'll see what the standard you mention says & try to stick to that.

    When I have tried to use Devel::Cover, I have found the output incomprehensible, even with the help of documentation. I was hoping to see some output from the automated CPAN processes, too, but I accept that it may be too early. I was planning to try the docs again if I got some output from the CPAN processes that I could compare.

    Regards,

    John Davies

    Update: I have put all my tests into a single file (the only way I could work out how to get them all through) & run Devel::Cover. The output is:

    ---------------------------- ------ ------ ------ ------ ------ ------ + ------ File stmt bran cond sub pod time + total ---------------------------- ------ ------ ------ ------ ------ ------ + ------ XML/Lenient.pm 100.0 67.7 88.8 100.0 n/a 39.4 + 88.8 xml/cover.t 100.0 n/a n/a 100.0 n/a 60.5 + 100.0 Total 100.0 67.7 88.8 100.0 n/a 100.0 + 93.1 ---------------------------- ------ ------ ------ ------ ------ ------ + ------
    I still have questions the docs don't answer to my comprehension, but these results may make sense to someone.

      This is in reponse to a private /msg and the UPDATE.

      It's too bad there are no cpancover results yet because I could have tried to explain the detailed version of the coverage report.

      So, let's focus on what you showed instead. What you have is the summary version of the report. This is the line that matters:

      XML/Lenient.pm 100.0 67.7 88.8 100.0 n/a 39.4 + 88.8

      This is the code that you want to analyze. You are not interested analyzing the coverage of the xml/cover.t test code, and I will show a way to automatically ignore that later. This summary line shows that you have 100% coverage for statements (stmt) and subroutines (subs). That is what you hope to see. It means that all your subs have been called at least once in your tests and that all simple lines of code have been executed at least once.

      The summary also states that you have less than 100% for branches (bran) and conditions (cond). This means that you have some code that your tests do not execute, and you need to analyze these results further. Unfortunately, I can't provide any details on how to do so without seeing a detailed report.

      Depending on what command(s) you ran to generate that summary report, you may already have the detailed report sitting there in your directory. Look for an HTML file somewhere under the directory where you ran the command.

      Lets assume you didn't generate a detailed report. Here is how I do it for one of my CPAN modules. I go to the parent directory of the "lib" directory, and I execute these commands:

      env PERL5LIB=lib PERL5OPT=-MDevel::Cover prove cover -report html -outputdir cover_report

      Here is the output I see:

      env PERL5LIB=lib PERL5OPT=-MDevel::Cover prove t/cr_lf.t ....... ok t/dumps.t ....... ok t/list_sigs.t ... ok t/parse_vcd.t ... ok t/pod.t ......... skipped: Test::Pod 1.22 required for testing POD t/use_stdout.t .. ok All tests successful. Files=6, Tests=78, 2 wallclock secs ( 0.06 usr 0.03 sys + 1.62 cusr + 0.24 csys = 1.95 CPU) Result: PASS cover -report html -outputdir cover_report Reading database from .../vcd/src/cover_db ---------------------------- ------ ------ ------ ------ ------ ------ + ------ File stmt bran cond sub pod time + total ---------------------------- ------ ------ ------ ------ ------ ------ + ------ ...cal/perl/5.14.2/bin/prove 100.0 50.0 n/a 100.0 n/a 19.1 + 87.5 lib/Verilog/VCD.pm 100.0 100.0 100.0 100.0 81.8 4.4 + 99.2 t/cr_lf.t 100.0 n/a n/a 100.0 n/a 12.1 + 100.0 t/dumps.t 100.0 n/a n/a 100.0 n/a 13.3 + 100.0 t/list_sigs.t 100.0 n/a n/a 100.0 n/a 12.3 + 100.0 t/parse_vcd.t 100.0 n/a n/a 100.0 n/a 13.3 + 100.0 t/pod.t 81.2 50.0 n/a 100.0 n/a 12.1 + 81.8 t/use_stdout.t 98.5 50.0 n/a 100.0 n/a 13.3 + 97.2 Total 99.2 95.0 100.0 100.0 81.8 100.0 + 98.4 ---------------------------- ------ ------ ------ ------ ------ ------ + ------ Writing HTML output to .../vcd/src/cover_report/coverage.html ... done.

      The last line shows where the HTML detailed report is. I bring the report into a browser with:

      firefox cover_report/coverage.html

      You should try to reproduce this for your code. You should not have to create a new file for all of your tests.

      As I mentioned earlier, the way to exclude coverage results for the test code itself is with a line like this:

      env PERL5LIB=lib PERL5OPT=-MDevel::Cover=-ignore,'t/.*',-ignore,prove +prove

        Yes, I've flagged those files for deletion. This happened because I thought the options I had set would prevent anything being uploaded before I'd checked if the name had been used. They didn't & it had. But deletion takes 72 hours to happen.

        Regards,

        John Davies

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1165847]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found