Test automation

As your software project grows, it is not anymore possible or even feasible to perform different test types manually. In addition, to enable a ready to use and ready to develop software, a project has to be tested for every code commit rather than for stable releases. By automating the testing procedures as far as possible, the project developers can save an enormous amount of time performing repeated procedures. Automation strategies also ensure that you have not missed certain testing criteria.

As a first step towards automation, we present to you certain tools which can help you manage different tests. Later on, this can be integrated into a continuous integration pipeline for performing tests with ease and receiving rapid feedback for every code committed to the git repository. In this workshop, automation of the test process is dealt with partially by defining different tests as tasks with the tool Paver. These Paver tasks serve as easy routines to perform different tests in your project and is good way of test documentation. But, enabling a continuous integration pipeline is a topic of its own and therefore is dealt with in a different Suresoft workshop on “Continuous Integration”.

Defining tasks with Paver

Different Paver tasks are written in the file pavements.py to the root of your project directory. A sample pavements.py script to run unit tests with Paver is below:

from paver.tasks import task
from paver.easy import sh

@task
def unit_tests():
    sh('py -m pytest ./test/unit_tests')

The above script can be executed easily with the command:

py -m paver unit_tests