CPAN Module Distributions
NOTE Numbers are added to the front of the t/*.t test script names 
because make test runs the test files in sorted order. By ordering your 
test scripts, you can test basic functionality at the start of the test run 
and reduce the time it takes to detect simple errors.
Another way to improve your testing is to use the Test::More module instead of 
Test. Test::More
14
 lets you write your tests in such a way that failing tests provide 
much more information. For example, consider a test case that verifies that the 
count() function returns a count of its arguments:
ok(Data::Counter::count( foo ,  bar ) == 2);
If this test fails, then all you're told is that the test failed.
If instead you used Test::More's is() function, then you'll get a much more 
useful error:
is(Data::Counter::count( foo ,  bar ), 2);
The is() function takes two arguments the operation to be tested and the 
expected value. If count() returns 3 instead of 2, then the test will fail with the 
following message:
#     Failed test (t/testname.t at line 3)
#          got:  3 
#     expected:  2 
Armed with the expected results and the actual return value, you may not even 
need to look at the test script to start debugging. Test::More includes testing 
functions for applying regular expressions (like()), comparing complex data 
structures (eq_array(), eq_hash(), eq_set(), and is_deeply()), and examining 
objects (can_ok() and isa_ok()). Test::More also contains support for skipping tests 
when they are known to fail under certain environments and marking tests as todo
items that are not expected to pass. See the Test::More documentation for details 
on all this and . . . well, more!
14. Written by Michael Schwern and available on CPAN
11
115
5






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

web hosting perl

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved