A practical guide to testing in Modern Perl

A practical guide to testing in Modern Perl

You do Perl and you know that tests are a good thing, but you've never had a chance to do it properly. They take a lot of your time, are very brittle and don't bring any real value. Sounds familiar? Then this book is for you. Rest assured, we'll show only real examples and real world problems.

About the Book

The book is in progress. Your feedback means a lot. Please let us know what you would like to read!

This is a book for pragmatic programmers. A little bit of theory and a lot of practical examples on how to test your software inside-out and outside-in. We try not to be very opinionated and explain different techniques and approaches to testing. You will find a lot of references if you're into the academia, but with examples applied to the real world problems that we are all facing in our day to day programming.

We will tackle together such important topics as the simplicity and effectiveness of unit tests, importance of integration tests and the business value of end to end testing. We will see how the tests can guide the development, fight the bug regressions and speed up feature implementations.

Share this book

Feedback

About the Authors

I am an open source freak with almost ~200 open repos (github.com/vti). Also I am a software quality addict, this is why I created kritika.io. In my free time (who has it?) I ride my road bicycle and participate in long-distance audax events (so-called randonneuring).

Hi, I'm Gregor. I've been a software developer for over 20 years now. My roles included team member and team lead in both software development and quality assurance. I live with my family and two cats in sunny Northern Germany.

Table of Contents

Introduction

Who should read this book

What this book is about

What this book is not about

The purpose of testing

Quick Start

Minimum prerequisites

Testing a logging module

The Testing Infrastructure

What are tests anyway?

Proving that we are wrong

The “Test Anything” Protocol

Testing a subroutine

Arrange, Act and Assert

Key Take Aways

CPAN Testers

Reporting tests as a user

Becoming a CPAN Tester

Improving your tests as an author

Autotest

Building the command line tool

Running a test program

Checking for change

Testing the application logic

Key Take Aways

Building the REST server

A word about resources

Testing a basic REST server

Incorporating our working code

Testing an API

Key Take Aways

Building the web application

Testing outside-in

Testing the client, not the server

Testing the functionality, not the GUI

Key Take Aways

Temporary data

Temporary directories and files

Temporary databases

Temporary version control repositories

Fake Services

Fake email server

Web Framework Testing

Catalyst

Non-deterministic code and tests

Side effects

Dates

Dependency injection

Factory method mocking

System call mocking

Race conditions

Unwanted randomness

Wanted randomness

Frequency test

Serial test

Poker test

Runs test

Autocorrelation test

Alternative test approaches and runners

Specification tests

Class-based testing

Cucumber/BDD/Gherkin

QuickCheck

Interactions with the outside world

Test results formatters

Continious integration services

Results reporting

Advanced testing patterns

Testing asynchronous code

Exotic testing patterns and methods

Mutation Testing

Notes

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Write and Publish on Leanpub

Authors, publishers and universities use Leanpub to publish amazing in-progress and completed books and courses, just like this one. You can use Leanpub to write, publish and sell your book or course as well! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.