Cover image for Perl Testing: A Developer's Notebook

Book description

Is there any sexier topic in software development than software testing? That is, besides game programming, 3D graphics, audio, high-performance clustering, cool websites, et cetera? Okay, so software testing is low on the list. And that's unfortunate, because good software testing can increase your productivity, improve your designs, raise your quality, ease your maintenance burdens, and help to satisfy your customers, coworkers, and managers.

Perl has a strong history of automated tests. A very early release of Perl 1.0 included a comprehensive test suite, and it's only improved from there. 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 to handle all sorts of testing problems that you may encounter, even in other languages.

Like all titles in O'Reilly's Developer's Notebook series, this "all lab, no lecture" book skips the boring prose and focuses instead on a series of exercises that speak to you instead of at you.

Perl Testing: A Developer's Notebook will help you dive right in and:

  • Write basic Perl tests with ease and interpret the results

  • Apply special techniques and modules to improve your tests

  • Bundle test suites along with projects

  • Test databases and their data

  • Test websites and web projects

  • Use the "Test Anything Protocol" which tests projects written in languages other than Perl

With today's increased workloads and short development cycles, unit tests are more vital to building robust, high-quality software than ever before. Once mastered, these lessons will help you ensure low-level code correctness, reduce software development cycle time, and ease maintenance burdens.

You don't have to be a die-hard free and open source software developer who lives, breathes, and dreams Perl to use this book. You just have to want to do your job a little bit better.

Table of Contents

  1. Perl Testing: A Developer’s Notebook
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. The Developer’s Notebook Series
      1. Notebooks Are...
      2. Notebooks Aren’t...
      3. Organization
    4. Preface
      1. What This Book Covers
      2. Conventions Used in This Book
      3. Using Code Examples
      4. Safari Enabled
      5. Comments and Questions
      6. Acknowledgments
        1. Ian Langworth
        2. chromatic
    5. 1. Beginning Testing
      1. Installing Test Modules
        1. How do I do that?
          1. Through the CPAN shell
          2. Through PPM
          3. By hand
        2. What about...
      2. Running Tests
        1. How do I do that?
        2. What just happened?
        3. What about...
      3. Interpreting Test Results
        1. How do I do that?
        2. What just happened?
        3. What about...
      4. Writing Your First Test
        1. How do I do that?
        2. What just happened?
        3. What about...
      5. Loading Modules
        1. How do I do that?
        2. What just happened?
        3. What about...
      6. Improving Test Comparisons
        1. How do I do that?
        2. What just happened?
        3. What about...
    6. 2. Writing Tests
      1. Skipping Tests
        1. How do I do that?
        2. What just happened?
      2. Skipping All Tests
        1. How do I do that?
        2. What just happened?
      3. Marking Tests as TODO
        1. How do I do that?
        2. What just happened?
        3. What about...
      4. Simple Data Structure Equality
        1. How do I do that?
        2. What just happened?
        3. What about...
      5. Data Composition
        1. How do I do that?
        2. What just happened?
        3. What about...
        4. Where to learn more
      6. Testing Warnings
        1. How do I do that?
        2. What just happened?
        3. What about...
      7. Testing Exceptions
        1. How do I do that?
        2. What just happened?
        3. What about...
    7. 3. Managing Tests
      1. Organizing Tests
        1. How do I do that?
        2. What just happened?
        3. What about...
      2. Checking Your Coverage
        1. How do I do that?
        2. What just happened?
        3. What about...
      3. Writing a Testing Library
        1. How do I do that?
        2. What just happened?
        3. What about...
      4. Testing a Testing Library
        1. How do I do that?
        2. What just happened?
        3. What about...
      5. Writing a Testing Harness
        1. How do I do that?
        2. What just happened?
      6. Testing Across the Network
        1. How do I do that?
        2. What just happened?
        3. What about...
      7. Automating Test Runs
        1. How do I do that?
        2. What just happened?
        3. What about...
    8. 4. Distributing Your Tests (and Code)
      1. Testing POD Files
        1. How do I do that?
        2. What just happened?
        3. What about...
      2. Testing Documentation Coverage
        1. How do I do that?
        2. What just happened?
        3. What about...
      3. Distribution Signatures
        1. How do I do that?
        2. What just happened?
      4. Testing Entire Distributions
        1. How do I do that?
        2. What just happened?
        3. What about...
      5. Letting the User Decide
        1. How do I do that?
        2. What just happened?
      6. Letting the User Decide (Continued)
        1. How do I do that?
        2. What just happened?
      7. Bundling Tests with Modules
        1. How do I do that?
        2. What just happened?
        3. What about?
      8. Collecting Test Results
        1. How do I do that?
        2. What just happened?
        3. What about...
      9. Validating Kwalitee
        1. How do I do that?
        2. What just happened?
        3. What about...
    9. 5. Testing Untestable Code
      1. Overriding Built-ins
        1. How do I do that?
        2. What just happened?
        3. What about...
      2. Mocking Modules
        1. How do I do that?
        2. What just happened?
        3. What about...
      3. Mocking Objects
        1. How do I do that?
        2. What just happened?
        3. What about...
      4. Partially Mocking Objects
        1. How do I do that?
        2. What just happened?
        3. What about...
      5. Overriding Live Code
        1. How do I do that?
        2. What just happened?
        3. What about...
      6. Overriding Operators Everywhere
        1. How do I do that?
        2. What just happened?
        3. What about...
    10. 6. Testing Databases
      1. Shipping Test Databases
        1. How do I do that?
        2. What just happened?
        3. What about...
      2. Testing Database Data
        1. How do I do that?
        2. What just happened?
        3. What about...
      3. Using Temporary Databases
        1. How do I do that?
        2. What just happened?
        3. What about...
      4. Mocking Databases
        1. How do I do that?
        2. What just happened?
        3. What about...
    11. 7. Testing Web Sites
      1. Testing Your Backend
        1. How do I do that?
        2. What just happened?
      2. Testing Your Frontend
        1. How do I do that?
        2. What just happened?
      3. Record and Play Back Browsing Sessions
        1. How do I do that?
        2. What just happened?
      4. Testing the Validity of HTML
        1. How do I do that?
        2. What just happened?
        3. What about...
      5. Running Your Own Apache Server
        1. How do I do that?
        2. What just happened?
      6. Testing with Apache-Test
        1. How do I do that?
        2. What just happened?
        3. What about...
        4. Where to learn more
      7. Distributing Modules with Apache-Test
        1. How do I do that?
        2. What just happened?
        3. What about...
    12. 8. Unit Testing with Test::Class
      1. Writing Test Cases
        1. How do I do that?
        2. What just happened?
        3. What about...
      2. Creating Test Fixtures
        1. How do I do that?
        2. What just happened?
        3. What about...
      3. Inheriting Tests
        1. How do I do that?
        2. What just happened?
      4. Skipping Tests with Test::Class
        1. How do I do that?
        2. What about...
      5. Marking Tests as TODO with Test::Class
        1. How do I do that?
        2. What about...
    13. 9. Testing Everything Else
      1. Writing Testable Programs
        1. How do I do that?
        2. What just happened?
        3. What about...
      2. Testing Programs
        1. How do I do that?
        2. What just happened?
        3. What about...
      3. Testing Interactive Programs
        1. How do I do that?
        2. What just happened?
        3. What about...
      4. Testing Shared Libraries
        1. How do I do that?
        2. What just happened?
        3. What about...
    14. Index
    15. About the Authors
    16. Colophon
    17. SPECIAL OFFER: Upgrade this ebook with O’Reilly