Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

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

I've written some simple tests with Test::WWW::Mechanize that check a Web site behaves as it should.

I am running these tests within cron, which sends me messages that look like:

1..8 ok 1 - The object isa Test::WWW::Mechanize ok 2 - Mech object created ok 3 - Submit bad password isa HTTP::Response ok 4 - Correct password welcomes us ok 5 - Bad password notified as a failed login ok 6 - Submit correct username and password isa HTTP::Response ok 7 - Correct password welcomes us ok 8 - Correct password not a failed login

If I alter cron to run the test script through prove I get briefer output:

test-dedicated....ok All tests successful. Files=1, Tests=8, 2 wallclock secs ( 0.16 cusr + 0.36 csys = 0.52 C +PU)

Ideally, I would like cron to only send mail if any tests fail. I could write a wrapper script to deal with this, but I wonder if you can think of a neater way?

I also wonder if I can easily report when the script didn't run at all. In this case, no tests will fail, but I still care about what happened.

Over time, I expect to add more tests in different scripts. For a collection of tests, does it make sense to write a Makefile.PL or can I get away with something like prove /path/to/*.t?

I'm looking for a clean and simple approach. Tools like Nagios look helpful, but seem like overkill for this problem to me. Any thoughts?


In reply to Reporting test failures within cron by tomhukins

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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 scrutinizing the Monastery: (7)
    As of 2014-12-21 13:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (105 votes), past polls