Using Perl’s Automated Testing Tools to Streamline Your Work

Ian Langworth and chromatic

[amazon_link asins=’0596100922′ template=’ProductAd’ store=’orahome-21′ marketplace=’UK’ link_id=’55d7bd9c-bcd8-11e8-9f01-cf10e0cf27e7′]

ISBN: 0596100922

Pages: 180

Publisher: O’Reilly

Topic: Perl

Buy Now from Amazon

What can compare with the thrill of software testing? Perhaps
balancing one’s checkbook, but that’s a task far removed from software
development. Software testing generally falls pretty low on the list of topics
that software developers find sexy. And this is unfortunate because good
software testing can increase productivity, improve designs, ease maintenance burdens, and help satisfy customers, coworkers, and managers, and eventually result in more time and energy for pursuing the subjects that software developers do find sexy.

Most software developers are already aware of the benefits of testing. They may even know about the wide range of available modules that Perl offers for testing Perl and non-Perl programs. In short, as authors Ian Langworth and chromatic note in their new book, “Perl Testing: A Developer’s Notebook” (O’Reilly), developers may know everything except where to start.

Perl has a strong history of automated tests. The earliest release of Per1 1.0
included a comprehensive test suite, and it has only improved since then. The
beauty of it, however, is that you don’t have to be a die-hard, free and open
source software developer who lives, breathes, and dreams Perl to put these
automated tests to use. You just have to want to do your job better.

“Of course, your main job probably isn’t Perl all the time,” Langworth
and chromatic tell their readers. “It may be just one of a handful of good tools
you use. That’s fine. Learning how Perl’s test tools work and how to put them
together to solve all sorts of previously intractable problems can make you a
better programmer in general. Besides, it’s easy to use the Perl tools described
here (and others that the future will bring) to handle all sorts of problems you
encounter, even in other languages.”

In the “all lab, no lecture” style of the Developer’s Notebooks, readers are
immediately immersed in hands-on exercises as they learn to:

-Write basic Perl tests with ease and interpret the results
-Apply special techniques and modules to improve tests
-Tests databases and their data
-Test web sites and web projects
-Use the “Test Anything Protocol” that tests projects written in languages other
than Perl

With today’s increased workloads and short development cycles, unit tests are
more vital to building high-quality software than ever before. Once mastered, the lessons in “Perl Testing: A Developer’s Notebook” will help developers ensure low-level code correctness, reduce software development cycle time, and ease maintenance burdens.

Table of Contents

The Developer’s Notebook Series
Preface

Chapter 1. Beginning Testing
Installing Test Modules
Running Tests
Interpreting Test Results
Writing Your First Test
Loading Modules
Improving Test Comparisons

Chapter 2. Writing Tests
Skipping Tests
Skipping All Tests
Marking Tests as TODO
Simple Data Structure Equality
Data Composition
Testing Warnings
Testing Exceptions

Chapter 3. Managing Tests
Organizing Tests
Checking Your Coverage
Writing a Testing Library
Testing a Testing Library
Writing a Testing Harness
Testing Across the Network
Automating Test Runs

Chapter 4. Distributing Your Tests (and Code)
Testing POD Files
Testing Documentation Coverage
Distribution Signatures
Testing Entire Distributions
Letting the User Decide
Letting the User Decide (Continued)
Bundling Tests with Modules
Collecting Test Results
Validating Kwalitee

Chapter 5. Testing Untestable Code
Overriding Built-ins
Mocking Modules
Mocking Objects
Partially Mocking Objects
Overriding Live Code
Overriding Operators Everywhere

Chapter 6. Testing Databases
Shipping Test Databases
Testing Database Data
Using Temporary Databases
Mocking Databases

Chapter 7. Testing Web Sites
Testing Your Backend
Testing Your Frontend
Record and Play Back Browsing Sessions
Testing the Validity of HTML
Running Your Own Apache Server
Testing with Apache-Test
Distributing Modules with Apache-Test

Chapter 8. Unit Testing with Test::Class
Writing Test Cases
Creating Test Fixtures
Inheriting Tests
Skipping Tests with Test::Class
Marking Tests as TODO with Test::Class

Chapter 9. Testing Everything Else
Writing Testable Programs
Testing Programs
Testing Interactive Programs
Testing Shared Libraries
Index

Perl Testing A Developers Notebook