Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: When 100% Code Coverage Backfires

by agianni (Hermit)
on Mar 26, 2007 at 13:12 UTC ( #606573=note: print w/replies, xml ) Need Help??

in reply to When 100% Code Coverage Backfires

Generally when given this scenario, I have used Test::MockModule to override something like Data::Record->records() in your example with results that would fully exercise the code, regardless of whether it would otherwise be triggered in its 'natural state'.

Correct me if I'm wrong, but that's a generally acceptable testing practice, isn't it?

perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'

Replies are listed 'Best First'.
Re^2: When 100% Code Coverage Backfires
by Ovid (Cardinal) on Mar 26, 2007 at 13:33 UTC

    Depends upon how one goes about it. I prefer to use Test::MockModule when I have something external I don't want to run or I have arguments I want to capture. In this case, it's reasonably to use it in addition to running the Data::Record code. However, that means that your mocked method would then be behaving in a way that it's impossible for the code to behave. I'm not sure how that's a win over providing asserts.


    New address of my CGI Course.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2022-08-07 19:04 GMT
Find Nodes?
    Voting Booth?

    No recent polls found