Perl Test-driven Development Ebook

Perl Test-driven Development Ebook

A few months ago, we quietly introduced our free-ebook-in-development, Testing Strategies for Modern Perl. Since then, we’ve been hard at work, and we’ve released the first major chunk.

For this first big release, we’re beginning with a step-by-step tutorial that goes into test-driven development (TDD) in Modern Perl using Test::Class, developing working code for a Tic-Tac-Toe application using our actual development process. We start with an overview of test-first, what makes a good test, and what you can expect from Test::Class in the following pages. Then we delve into creating a new business-logic object for our sample application.

From there, we are moving on to address:

  • Table-driven testing, and other test-reuse strategies,
  • Mock objects and mocking modules, the process of creating a simplified simulation of a dependency, such as a mock method that substitutes for reading data from a file but instead always returns a constant record of data.
  • Subsystem and integration testing, testing modules working together and testing the system as a whole.
  • Testing user-interfaces, both command-line and web UI.
  • Testing with databases and application configuration files.
  • Refactoring strategies, both for production code and for refactoring tests.
  • Testing frameworks, specifically our preferred Test::Class, and a survey of Perl mocking libraries from CPAN.
  • Using Continuous Integration (CI) tools with your Perl projects to automatically run test suites and report when a code change breaks a test.
  • Testing legacy Perl, modernizing it as described in Michael Feathers’ Working Effectively with Legacy Code.
  • Testing Perl 6.

We’ve published all of our sample code and code templates on GitHub. This repository contains step-by-step commits corresponding to the tutorial text.

Here’s how you can get your copy. Click here to sign up to receive chapters from the ebook as it’s developed. In return, every month or three, you’ll get an email with another chapter or update. This is a very low volume list, which contains messages only about the ebook. We’ll also be asking for your comments, and you’ll be able to have your feedback counted.

Peace, love, and may all your TAP output turn green…

Tim King is Lead Developer at The Perl Shop. Tim got his start writing real-time embedded software for high-speed centrifuges the 1980’s and went on to do embedded software for Kurzweil Music Systems and Avid Technology. He has been developing for the web since the web existed, and brings discipline and skills honed from embedded systems to enterprise software. His expertise is in designing for software quality, achieved through automated code testing, test-first development, and risk managed refactoring, all through an agile process. This approach naturally lends itself to working with legacy code, such as successfully and safely refactoring a 465-line legacy function used in a video streaming application into a structurally sound design. Or designing for maintainability, through cleanly layered architectures, like a web service that can handle multiple RPC protocols using a common controller and a thin view layer, that can easily be supplemented to handle additional protocols. Tim is skilled in Perl, JavaScript, and other programming languages, in Internet protocols, in SQL, and is familiar with the internals of a variety of open source applications. Tim also writes and performs music, and has authored and published a number of inspirational books.

Leave a Reply

Your email address will not be published. Required fields are marked *