Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
xdg wrote
I think I just don't "get" Test::LectroTest.
Maybe this will help.

I wrote LectroTest because I wanted an alternative to traditional, case-based unit testing that offered markedly different cost, benefit, and mental models for testing. There are many times when case-based testing sucks, and for these times LectroTest offers programmers another option. The two approaches complement each other and can even be seen as duals.

The LectroTest approach requires programmers to be explicit about what their programs are supposed to do. Programmers must write property specifications that define the required behaviors of their programs. Then LectroTest uses random sampling to automate the process of gathering evidence to support (or refute) the claims made by the property specifications.

Case-based testing, on the other hand, requires programmers to write individual test cases that each provides incremental evidence for (or against) some implied claim of overall correctness. Together, the test cases represent an implicit definition of correctness, but such definitions are usually difficult to extrapolate from the cases and often are nebulous and incomplete, which isn't necessarily a bad thing: in real life, formal notions of correctness may be hard to define.

A table makes the salient differences easy to see:

LectroTest Case-based testing
Definition of correctness Explicit
(via hand-written properties)
Implicit
(via manual extrapolation)
Test cases Implicit
(automatically generated)
Explicit
(written by hand)

Which approach is best depends on what you are doing. As a rule of thumb, if you can easily specify what a piece of code ought to do, there's a good chance that LectroTest will be a great way to test that code. If, however, you are working on code for which correctness is a difficult concept to formalize, case-based testing will probably be the more fruitful approach.

Cheers,
Tom


In reply to What Test::LectroTest is all about by tmoertel
in thread When test-driven development just won't do by Ovid

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?
    vrk adds oatmeal cookies to the platter on the sideboard.
    [LanX]: evrybody can participate in a YAPC
    choroba is still undecided what to present at YAPC
    [LanX]: imagine the stock market if the choice for the second round would have been those two ...
    [robby_dobby]: LanX: Not me. No YAPC in my country and the only one in Asia is so far off in Japan
    [LanX]: Oh I thought "Misery" meant Missoury
    [LanX]: where do you live?
    [LanX]: YAPC Asia was renamed and you'd need to speak Japanese to be able to follow
    [robby_dobby]: LanX: Misery :P
    [robby_dobby]: Or India

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (12)
    As of 2017-04-24 15:55 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      I'm a fool:











      Results (442 votes). Check out past polls.