What do you think?
Rate this book


201 pages, Kindle Edition
First published July 3, 2014
The book lets you get your hands dirty with the basic building blocks in testing, which are unit tests. [In chapter 2] you will be taken through what a unit test is, the basic syntax, and examples of a simple unit test. Then, you take a comprehensive look at the methods available to use in unit testing and [in chapter 3] the various tools [NOSE and PyTest] available to help in running and debugging your tests. Wrapping up the unit test section, you look into the pivotal use of mocks and patching, which allow you to isolate the code you are interested in testing (your “units”), and simulate responses from other parts of the system or libraries.Although I agree with the Goodreads reviewer Arquero who considers that the chapters on deployment are not quite up to scratch, kudos to David Sale for providing an excellent and very down to earth overview of how an important number of software development tools for Python programs focused around testing fit together. Since this is such a dynamic area, I only hope a second edition is on the verge of coming out, focusing on up-to-date open-source tools for Python 3.
[Including executable test cases] in your documentation is one of the more interesting parts of Python testing. [Chapter 4] shows you how to effectively embed unit tests in your doc strings and have them run as tests […]
Your attention then turns to the more recent hot topic of test driven development (TDD)[…] The TDD section [chapter 5] introduces the concepts and ethos of the practice and covers steps required to adopt it. I provide [simple] use cases using TDD in pair programming […]
One of the more recent aspects of testing and something the development community as a whole has moved toward is the concept of behavior driven development (BDD) and acceptance testing [using Lettuce, a Python adjusted version of Cucumber, and briefly mentioning Robot -see chapters 6, 7]. This builds on the TDD approach, helping you to construct tests that ensure features of your application meet the acceptance criteria of your stakeholders […]
[Chapter 8 covers performance testing tools, Jmeter and cProfile].
[Chapter 9] also covers keeping your code in check. In the development cycle, you write a lot of code and in the majority of cases this code needs to be read by someone other than you. This means effective, actionable standards need to be applied across the Python community. This is where PEP-8 came in and tools have evolved around this to help maintain the standards. You look at effective ways to use tools such as PyLint and code coverage to ensure your code is maintainable, and your tests cover the parts of your application that matter.
A key feature of many teams is having some form of build [and deployment processes. Chapter 10 and 11 introduce Paver to automate build processes and Jenkins for continuous integration, showing how, together with Heroku, they can thread together the previous tools amd provide help for deployment on the Cloud]. After applying all these techniques and processes to your application, you should then be nearing release of your product! This is where you take a look into smoke testing (a type of testing which shows different components of an application are working together correctly)...