In this specific blog post, I will talk about the tools I use and how to get them installed/configured. In future postings I'll set up a sample code base with sample unit tests and run the tests manually. Finally in the last posting, I'll talk about using Jenkins to automate the testing.
Let's get started
I tend to do most of my python development on the Linux platform. I love python's cross platform features. While most of my client implementations actually run in Microsoft Windows, I still do my development in Linux.
For the purposes of this blog series, I will be using Ubuntu 11.10, the 64 bit version. This distribution/version isn't necessary, but that what I'm using. Python 2.7 comes with the default installation. If for whatever reason python isn't installed on your system, just type "sudo apt-get install python" from the bash prompt:
Source control
When we move on to automating the testing/analysis, you'll need to have some source control in place. I use git. Even if you aren't planning on doing the automation part, source control is still a good idea. Again, you can get it with a single command: "sudo apt-get install git"
Tools of the trade
There are a number of testing, quality and coverage tools out there for python. These are the ones I use:
Unit testing: unittest - Comes with python. It's part of the standard library.
Mocking: mock by Michael Foord - It's available in apt.
Test runner: nose - Also available in apt.
Code coverage: coverage - Also, also available in apt.
Code quality: pylint - Also, also, also available in apt.
So to get all these great tools you simply need to type one command: "sudo apt-get install python-mock python-nose python-coverage pylint"
That's it. If you're following along, you should have a fully ready python development environment. Tune in to the next posting where I'll create a repository, some sample code and sample unit tests. Then I'll manually run the testing, coverage and quality analysis tools against it.