Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Good links there. Appreciate it.

In this theme, I went ahead and tried to setup an env similar to the layout described in this link:

StackOverFlow Complete build/unittest/codecoverage

couple of things that I did:

  • Created the layout described. Made directories for 'lib' and 't'.
  • Copied my script to lib. Flipped the extension to pm. Added a package statement to the script. Also added: __PACKAGE__->main( @ARGV ) unless caller();
  • Wrapped the main block of code, what I called the implied main, in sub main{...}

Then I was able to add a stanza to my test file.

my $my_dev_1 = sample::main("my-dev-1"); is($my_dev_1, "--- classes: - all - dev ", "my dev 1 test");

Not sure how I feel about the sample::main("my-dev-1"). Would appreciate some feedback on that to see if I am calling this correctly.

That said, I was able to generate code cover from this setup.

$ ./Build test
$ ./Build testcover

---------------------------- ------ ------ ------ ------ ------ ------ ------
File                           stmt   bran   cond    sub    pod   time  total
---------------------------- ------ ------ ------ ------ ------ ------ ------
blib/lib/sample.pm             97.4   91.7    n/a  100.0    0.0  100.0   93.2
Total                          97.4   91.7    n/a  100.0    0.0  100.0   93.2
---------------------------- ------ ------ ------ ------ ------ ------ ------

That processes pumps out a cover.html file that kinda aligns more with what I was hoping to see. The changes to the original code are not significant, but they are changes, more than what I was hoping to make, perhaps digging in harder on Test::Output would help.


In reply to Re^2: Looking for help for unit tests and code coverage on an existing perl script by tizatron
in thread Looking for help for unit tests and code coverage on an existing perl script by tizatron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (7)
    As of 2020-03-30 15:52 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      To "Disagree to disagree" means to:









      Results (175 votes). Check out past polls.

      Notices?