If anyone is interested, Packt is running a summer deal on some of their best selling titles. Looks like a couple good Python books in the mix.
Here's a link
http://www.packtpub.com/article/packts-best-selling-open-source-books-offer
Saturday, July 16, 2011
Book Review - Python Testing Cookbook
In an recent effort to improve my testing skills, I decided I would check out the Packt Publishing book, Python Testing Cookbook by Greg L. Turnquist. The book promises to give “simple and effective recipes for testing Python code”, starting with the most basic testing tool unittest and working into more complex tools like doctest, Nose and the BDD tool Lettuce. The book also touches on some additional topics like code coverage reports, acceptance testing, load testing and configuring tests to run under continuous integration.
My initial interest in the book came from the chapters on continuous integration and code coverage, chapters six and seven respectively. With both of these topics, I've had some experience with the tools that are available in the Java world and I was very curious to see what tools are available for me to use with my Python code.
Having said that, after digging into the book a bit, I think the chapter I found the most interesting was Chapter 4, Testing Customer Stories with Behavior Driven Development. The chapter starts with a very quick introduction to BDD and progresses into first recipe, which shows how to perform some simple BDD style tests with a custom Nose plugin. The chapter then progresses into recipes for doctest, Nose's spec plugin and Lettuce. While the chapter is not going to turn someone into a master of BDD, it is a good introduction to the software that is available for Python developers and contains some good recipes for quickly getting started and utilizing BDD to test an application.
In addition to Chapter 4, I also enjoyed Chapters 6 and 7 quite a bit. Chapter 6 details a few different ways to integrate Python tests with the continuous integration platforms of Jenkins and TeamCity. These recipes include setting up both services to generate reports, run tests on commit and run tests on a scheduled interval. Chapter 7 is similar, but details how to use the coverage tool with a suite of unit tests. This chapter is made up of recipes which show how to install and run coverage, how to generate XML & HTML reports and how to integrate coverage with Nose and Jenkins.
As a whole I enjoyed the book and I thought that I was able to pick up some nice new pointers for testing my Python applications. As a recommendation for other readers, I would strongly suggest the book to new Python and Python TDD developers. For these developers, each chapter should provide new information and help to get the developer up-to-speed very quickly.
For someone that is already familiar with Python and Python TDD, I would suggest checking out the table of contents for the book. Each chapter is very helpful and provides a good introduction to the topics discussed in the chapter, however because the chapters are written as introductions, if you are already familiar with the topic for that chapter, its unlikely that you'll pick up much new from the chapter.
My initial interest in the book came from the chapters on continuous integration and code coverage, chapters six and seven respectively. With both of these topics, I've had some experience with the tools that are available in the Java world and I was very curious to see what tools are available for me to use with my Python code.
Having said that, after digging into the book a bit, I think the chapter I found the most interesting was Chapter 4, Testing Customer Stories with Behavior Driven Development. The chapter starts with a very quick introduction to BDD and progresses into first recipe, which shows how to perform some simple BDD style tests with a custom Nose plugin. The chapter then progresses into recipes for doctest, Nose's spec plugin and Lettuce. While the chapter is not going to turn someone into a master of BDD, it is a good introduction to the software that is available for Python developers and contains some good recipes for quickly getting started and utilizing BDD to test an application.
In addition to Chapter 4, I also enjoyed Chapters 6 and 7 quite a bit. Chapter 6 details a few different ways to integrate Python tests with the continuous integration platforms of Jenkins and TeamCity. These recipes include setting up both services to generate reports, run tests on commit and run tests on a scheduled interval. Chapter 7 is similar, but details how to use the coverage tool with a suite of unit tests. This chapter is made up of recipes which show how to install and run coverage, how to generate XML & HTML reports and how to integrate coverage with Nose and Jenkins.
As a whole I enjoyed the book and I thought that I was able to pick up some nice new pointers for testing my Python applications. As a recommendation for other readers, I would strongly suggest the book to new Python and Python TDD developers. For these developers, each chapter should provide new information and help to get the developer up-to-speed very quickly.
For someone that is already familiar with Python and Python TDD, I would suggest checking out the table of contents for the book. Each chapter is very helpful and provides a good introduction to the topics discussed in the chapter, however because the chapters are written as introductions, if you are already familiar with the topic for that chapter, its unlikely that you'll pick up much new from the chapter.
Subscribe to:
Posts (Atom)