<?xml version="1.0" encoding="windows-1252"?>
<node id="480898" title="Re: Test::LectroTest and pseudo random distributions" created="2005-08-04 12:01:48" updated="2005-08-12 10:02:16">
<type id="11">
note</type>
<author id="268515">
xdg</author>
<data>
<field name="doctext">
&lt;p&gt;No offence to [mod://Test::LectroTest] intended, but in what way is this a test?  For the "1 to 6" behavior, unless you're trying to test the underlying functions &lt;code&gt;rand&lt;/code&gt; and &lt;code&gt;int&lt;/code&gt; the only thing that matters is the endpoints of rand, which are 0 and a number close to 1 -- neither which [mod://Test::LectroTest] are guaranteed to hit (and are even unlikely to hit).  (See my module [mod://Test::MockRandom] for a way to actually test your endpoints.)  For the distribution, visually seeing it doesn't confirm anything, putting you right back to having to use one of the Statistics:: modules.
&lt;/p&gt;
&lt;p&gt;I think I just don't "get" Test::LectroTest.  To me, it feels like a thin veneer of testing -- "well, I tried it a bunch of times and it seemed to work".  If the point is to identify edge/corner cases, it would seem to me to be better to identify and test them directly.  If one isn't sure where these cases are, [mod://Devel::Cover] will reveal them.  (Note -- coverage is not correctness, but coverage will point out branches/conditions not taken in the code, which are the edge cases.)&lt;/p&gt;
&lt;p&gt;On reflection, maybe the point of Test::LectroTest is to try to expose the edge cases in your dependencies outside your own conditionals -- &lt;code&gt;sqrt&lt;/code&gt; and division by zero come to mind.  But I'd call it "stress testing" in that case and suggest that it is different from the way the term "testing" is usually meant in the various perl test suites.  It doesn't tell you that your code is correct, only that it hasn't been shown to be incorrect for some number of trials.&lt;/p&gt;
&lt;p&gt;Test::LectroTest's author's &lt;a href="http://community.moertel.com/~thor/talks/pgh-pm-talk-lectrotest.pdf"&gt;presentation&lt;/a&gt;  has a fairly good example using [mod://Email::Address], but includes a rather length set of email address generators (p. 49) which opens the question of how you know whether the error is in the generators or in the code?&lt;/p&gt;
&lt;p&gt;If someone's used Test::LectroTest extensively, I'm very curious to know in what kinds of cases it's proved useful.&lt;/p&gt;

&lt;div class="pmsig"&gt;&lt;div class="pmsig-268515"&gt;
&lt;p&gt;-xdg&lt;/p&gt;
&lt;p&gt;&lt;small&gt;&lt;i&gt;Code written by xdg and posted on PerlMonks is &lt;a href="http://creativecommons.org/licenses/publicdomain"&gt;public domain&lt;/a&gt;. It is provided &lt;b&gt;as is&lt;/b&gt; with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.&lt;/i&gt;&lt;/small&gt;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
480680</field>
<field name="parent_node">
480849</field>
</data>
</node>
