Book Image

Python Testing: Beginner's Guide

By :
Book Image

Python Testing: Beginner's Guide

By:

Overview of this book

<p>Automated testing moves much of the labor of testing off the developer and makes it easier as well as quicker to find bugs and fix them. Automated tests run faster, increase test coverage, and lower costs. However, testing is neither an easy process nor remotely exciting for most developers. But with the right techniques and tools, testing can become a simple and gratifying part of the development process.<br /><br />With this helpful guide – from an expert – in your hand, testing will not be a tiresome topic for you anymore. You will learn how to test your Python projects in the easiest way, making other parts of the development process easier and more enjoyable. <br /><br />This book covers the tools and techniques of automated testing and test-driven development. Starting from the very basics, the chapters introduce new tools and techniques in simple, accessible language with step-by-step examples. You will explore how to make testing easier and more accurate with Python's doctest module and learn test-driven development using the unittest framework. You will also learn how to keep your units separate from each other and discover a simple and easy way to integrate Mocker and unittest. Next, we cover integration testing and web application testing.<br /><br />Automated testing gives developers better feedback, faster and more often. Bugs get found sooner and fixed better, with less effort. By the end of this book, you will have all of the skills needed to benefit from automated testing.</p>
Table of Contents (17 chapters)
Python Testing
Credits
About the Author
About the Reviewers
Preface
Index

Time for action – what are you going to do?


It's time for you to come up with a project of your own, something that you can work on by yourself; we step through the development process:

  1. Think of a project of approximately the same complexity as the one described in this chapter. It should be a single module or a few modules in a single package.

  2. Imagine that the project is already done, and you need to write a description of what you've done, along with a little bit of demonstration code. Then go ahead and write your description and demo code in the form of a doctest file.

  3. As you're writing the doctest file, look out for places where your original idea has to change a little bit to make the demo easier to write, or work better. When you find such cases, pay attention to them! At this stage, it's better to change the idea a little bit and save yourself effort all through the process.

What just happened?

We've got testable specifications for moderately-sized projects, now. These will help us to...