Automated tests are essential for quality assurance for software development. They allow to assure that the code works as expected and can be used as documentation of its behavior. Furthermore, later changes are facilitated because the automation allows to reproduce exactly the same tests with very little human effort.
The tutorial will give a short overview of the types of tests such as unit test, integration tests, and functional tests.
Python comes with the unittest and doctests modules. We will look at how they work what advantages and disadvantages they have.
The focus of the tutorial will be py.test, a pythonic testing frame work that uses conventions to reduce configuration and programming effort.
A simple project will be used to show the general usage of py.test. After setting up and running some test, we will discover some useful workflow tools such as skipping test using simple patterns.
Setting up and tearing down test can be expensive. py.test offers possibilities to reuse code.
Often test are very similar with only slight variations. Programming them would introduce code repetition. Therefore, py.test allows to generate tests programmatically.
Finally, we will look at the ways to use py.test for different Python versions or implementations and different machines.