Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I use the perl Test framework to test lots-a-things. These are all crude test examples below -
# check webservice like( `lynx http://tiago.com -head -dump`, qr/200 OK/, 'HEAD request using lynx' ); # disk space for (`df`) { my ($filesystem, $use) = /^(\S+) .+ (\d+)%/; next unless ($filesystem && $use); ok($use < 70, "$use \%filesystem"); } # running daemons my @ps = `ps -e`; for my $daemon (qw(crond syslogd ntpd)) { my $cnt = grep /$daemon/, @ps; ok($cnt, "$daemon ($cnt)"); } # software version like( `nmap --version`, qr/\W3\.\d/, 'nmap version test' ); # binaries and path for my $bin ('ping','kill','pod2text', 'nslookup', 'tail') { my $loc = `which $bin`; chomp $loc; ok(stat($loc), $loc); ok(-x _, 'executable by effective uid/gid'); } # ping the machine $ip = '66.39.54.27'; my $ret = join('', `ping -c 5 -W 1 $ip`); like($ret, qr/ 0\% packet loss/, 'packet loss'); + # DNS $ip = '66.39.54.27'; $name = 'perlmonks.org'; like(`host $ip`, qr/$name/, 'DNS'); like(`host $name`, qr/$ip/, 'reverse DNS');
It's also not hard to make other languages output in the format usable by Test::Harness, so incidently, if anyone care to make a shell library of functions that mimic the Test::More module, drop me a note, I'm interested.

Tiago

In reply to Re: using Test::* modules for generic testing of non perl stuff? by tstock
in thread using Test::* modules for generic testing of non perl stuff? by jfroebe

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2021-07-27 14:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?