Test::Simple 0.70
Sponsored Links
Test::Simple 0.70 Ranking & Summary
File size:
0.076 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
913
Date added:
2007-05-04
Publisher:
Michael G Schwern
Test::Simple 0.70 description
Test::Simple is a Perl module with basic utilities for writing tests.
SYNOPSIS
use Test::Simple tests => 1;
ok( $foo eq $bar, foo is bar );
** If you are unfamiliar with testing read Test::Tutorial first! **
This is an extremely simple, extremely basic module for writing tests suitable for CPAN modules and other pursuits. If you wish to do more complicated testing, use the Test::More module (a drop-in replacement for this one).
The basic unit of Perl testing is the ok. For each thing you want to test your program will print out an "ok" or "not ok" to indicate pass or fail. You do this with the ok() function (see below).
The only other constraint is you must pre-declare how many tests you plan to run. This is in case something goes horribly wrong during the test and your test program aborts, or skips a test or whatever. You do this like so:
use Test::Simple tests => 23;
You must have a plan.
ok
ok( $foo eq $bar, $name );
ok( $foo eq $bar );
ok() is given an expression (in this case $foo eq $bar). If its true, the test passed. If its false, it didnt. Thats about it.
ok() prints out either "ok" or "not ok" along with a test number (it keeps track of that for you).
# This produces "ok 1 - Hell not yet frozen over" (or not ok)
ok( get_temperature($hell) > 0, Hell not yet frozen over );
If you provide a $name, that will be printed along with the "ok/not ok" to make it easier to find your test when if fails (just search for the name). It also makes it easier for the next guy to understand what your test is for. Its highly recommended you use test names.
All tests are run in scalar context. So this:
ok( @stuff, I have some stuff );
will do what you mean (fail if stuff is empty)
Test::Simple will start by printing number of tests run in the form "1..M" (so "1..5" means youre going to run 5 tests). This strange format lets Test::Harness know how many tests you plan on running in case something goes horribly wrong.
If all your tests passed, Test::Simple will exit with zero (which is normal). If anything failed it will exit with how many failed. If you run less (or more) tests than you planned, the missing (or extras) will be considered failures. If no tests were ever run Test::Simple will throw a warning and exit with 255. If the test died, even after having successfully completed all its tests, it will still be considered a failure and will exit with 255.
So the exit codes are...
0 all tests successful
255 test died or all passed but wrong # of tests run
any other number how many failed (including missing or extras)
If you fail more than 254 tests, it will be reported as 254.
This module is by no means trying to be a complete testing system. Its just to get you started. Once youre off the ground its recommended you look at Test::More.
SYNOPSIS
use Test::Simple tests => 1;
ok( $foo eq $bar, foo is bar );
** If you are unfamiliar with testing read Test::Tutorial first! **
This is an extremely simple, extremely basic module for writing tests suitable for CPAN modules and other pursuits. If you wish to do more complicated testing, use the Test::More module (a drop-in replacement for this one).
The basic unit of Perl testing is the ok. For each thing you want to test your program will print out an "ok" or "not ok" to indicate pass or fail. You do this with the ok() function (see below).
The only other constraint is you must pre-declare how many tests you plan to run. This is in case something goes horribly wrong during the test and your test program aborts, or skips a test or whatever. You do this like so:
use Test::Simple tests => 23;
You must have a plan.
ok
ok( $foo eq $bar, $name );
ok( $foo eq $bar );
ok() is given an expression (in this case $foo eq $bar). If its true, the test passed. If its false, it didnt. Thats about it.
ok() prints out either "ok" or "not ok" along with a test number (it keeps track of that for you).
# This produces "ok 1 - Hell not yet frozen over" (or not ok)
ok( get_temperature($hell) > 0, Hell not yet frozen over );
If you provide a $name, that will be printed along with the "ok/not ok" to make it easier to find your test when if fails (just search for the name). It also makes it easier for the next guy to understand what your test is for. Its highly recommended you use test names.
All tests are run in scalar context. So this:
ok( @stuff, I have some stuff );
will do what you mean (fail if stuff is empty)
Test::Simple will start by printing number of tests run in the form "1..M" (so "1..5" means youre going to run 5 tests). This strange format lets Test::Harness know how many tests you plan on running in case something goes horribly wrong.
If all your tests passed, Test::Simple will exit with zero (which is normal). If anything failed it will exit with how many failed. If you run less (or more) tests than you planned, the missing (or extras) will be considered failures. If no tests were ever run Test::Simple will throw a warning and exit with 255. If the test died, even after having successfully completed all its tests, it will still be considered a failure and will exit with 255.
So the exit codes are...
0 all tests successful
255 test died or all passed but wrong # of tests run
any other number how many failed (including missing or extras)
If you fail more than 254 tests, it will be reported as 254.
This module is by no means trying to be a complete testing system. Its just to get you started. Once youre off the ground its recommended you look at Test::More.
Test::Simple 0.70 Screenshot
Test::Simple 0.70 Keywords
Simple 0.70
For Writing
writing tests
Perl module
tests
test
module
basic
Perl
writing
Test::Simple
TestSimple
Test::Simple 0.70
Libraries
Programming
Bookmark Test::Simple 0.70
Test::Simple 0.70 Copyright
WareSeeker periodically updates pricing and software information of Test::Simple 0.70 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Test::Simple 0.70 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Test::More is yet another framework for writing test scripts. Free Download
Acme::Tests is a Perl module to see how much do you know. Free Download
Test::Differences Perl module contains test strings and data structures and show differences if not ok. Free Download
Test::TestCoverage is Perl module to test if your test covers all public subroutines of the package. Free Download
Test::WWW::Selenium is a Perl module to test applications using Selenium Remote Control. Free Download
Test::WWW::Accessibility is a Perl module to test web pages for accessibility. Free Download
Test::Data is a Perl module to test functions for particular variable types. Free Download
Test::Unit::tests::AllTests is a unit testing framework self tests. Free Download
Latest Software
- Microsoft Exam 70-294 Guide is Free 9.0
- Cisco Exam 642-871 Guide is Free 9.0
- ATG Commerce Exam EE0-021 Guide is Free 9.0
- Altiris Helpdesk 060-HDS-A600 Guide 9.0
- HDI Exam HD0-400 Guide is Free 9.0
- Novell NetWare Exam 50-690 Guide is Free 9.0
- Juniper Networks JN0-320 Guide is Free 9.0
- LPI Linux LPIC 117-202 Guide is Free 9.0
Popular Software
Favourite Software
- Foundry Certification Exam Guide 9.0
- Novell ZENworks 50-694 Guide is Free 9.0
- Nortel VoIP Exam 920-140 Guide is Free 9.0
- Linux LPI Exam 117-101 Guide is Free 9.0
- Oracle 9i Exam 1Z0-007 Guide is Free 9.0
- Juniper Exam JN0-561 Guide is Free 9.0
- JBoss Certification Exam Guide is Free 9.0
- Novell NetWare Exam 50-686 Guide is Free 9.0