ADBRITE ads links
You are here: CodeIdol.com > Perl > Intermediate Perl > Advanced Testing
Intermediate Perl
| 18.1. Testing Large Strings
We showed in Chapter 17 that when a test fails, Test::More can show us what we expected and what we actually got.
#!/usr/bin/perl
use Test::More 'no_plan';
is( "Hello Perl", "Hello perl" );
When I run th...
|
|
| 18.2. Testing Files
The code to test things like file existence and file size is simple, but the more code we write, and the more parts each code statement has, the more likely we are not only to mess up, but to miscommunicate our intent ...
|
|
| 18.3. Testing STDOUT or STDERR
One advantage to using the ok( ) functions (and friends) is that they don't write to STDOUT directly, but to a filehandle secretly duplicated from STDOUT when our test script begins. If...
|
|
| 18.4. Using Mock Objects
Sometimes we don't want to ramp up the entire system to test only parts of it. We can be fairly certain, or at least assume, that other parts of the system work. We don't need to open expensive database connect...
|
|
| 18.5. Testing POD
We can even test things that aren't code. Documentation is just as important as code, since other people can't use our perfect, lovely code unless they know what to do with it. As we mentioned in Chapter 16, the Perl way...
|
|
| 18.6. Coverage Testing
We can also test our testing. In a perfect world, we'd test our program with every possible input and environment so that our program follows every particular path. That's certainly what the Professor would...
|
|
| 18.7. Writing Your Own Test::* Modules
You don't have to wait for other people to write cool test modules. If you have a particular testing situation that you'd like to wrap up in a test function, you can write your own Test::* module using ...
|
|
| 18.8. Exercises
You can find the answers to these exercises in "Answers for Chapter 18" in the Appendix.
18.8.1. Exercise 1 [20 min]
Document the My::List::Util module you created in the exercise for Chapter 17. Add a test for the POD document...
|
|
You are here: CodeIdol.com > Perl > Intermediate Perl > Advanced Testing
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|