Leanpub Header

Skip to main content

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.

Minimum price

$19.99

$29.99

You pay

$29.99

Authors earn

$23.99
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
About

About

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

Author

About the Authors

Viacheslav Tykhanovskyi

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).

Gregor Goldbach

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.

Contents

Table of Contents

Introduction

  1. Who should read this book
  2. What this book is about
  3. What this book is not about

The purpose of testing

Quick Start

  1. Minimum prerequisites
  2. Testing a logging module

The Testing Infrastructure

  1. What are tests anyway?
  2. Proving that we are wrong
  3. The “Test Anything” Protocol
  4. Testing a subroutine
  5. Arrange, Act and Assert
  6. Key Take Aways

CPAN Testers

  1. Reporting tests as a user
  2. Becoming a CPAN Tester
  3. Improving your tests as an author

Autotest

  1. Building the command line tool
  2. Running a test program
  3. Makefile
  4. Gregor’s story
  5. Coding for CPAN
  6. Checking for change
  7. Testing the application logic
  8. Black box and white box testing
  9. Key Take Aways
  10. Building the REST server
  11. A word about resources
  12. Testing a basic REST server
  13. Incorporating our working code
  14. Testing an API
  15. Key Take Aways
  16. Building the web application
  17. Testing outside-in
  18. Testing the client, not the server
  19. Testing the functionality, not the GUI
  20. Key Take Aways

Temporary data

  1. Temporary directories and files
  2. Temporary databases
  3. Temporary version control repositories

Fake Services

  1. Fake email server

Web Framework Testing

  1. Catalyst

Non-deterministic code and tests

  1. Side effects
  2. Dates
  3. Dependency injection
  4. Factory method mocking
  5. System call mocking
  6. Race conditions
  7. Unwanted randomness
  8. Wanted randomness
  9. Frequency test
  10. Serial test
  11. Poker test
  12. Runs test
  13. Autocorrelation test

Alternative test approaches and runners

  1. Specification tests
  2. Class-based testing
  3. Cucumber/BDD/Gherkin
  4. QuickCheck

Interactions with the outside world

  1. Test results formatters
  2. Continious integration services
  3. Results reporting

Advanced testing patterns

  1. Testing asynchronous code

Exotic testing patterns and methods

  1. Mutation Testing

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

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

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

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. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub