testIDEA and Python

Concepts ››
Parent Previous Next

testIDEA and Python

Scripting and GUI are two ways of interaction with computers. Advantages of scripting are flexibility and automation, while GUI enables us quick start-up. This section describes how to connect testIDEA and Python scripts, to get benefits of both worlds.

Scripts can be used for two different tasks. The first task is execution of tests and analysis of results, the second task is extending test functionality. Both tasks are described below.

Executing tests from Python

Tests should be run often to detect errors as soon as possible. Furthermore, we also want to have more flexibility for configuring test environment and the hardware which runs our application. These are tasks for scripts. Now the main question arises - how can we reuse test specifications created with testIDEA in scripting environment?

The answer is: By loading test specifications from test specification file and executing it with the help of isystem.test API.

Detailed step by step instructions are given in section Executing tests with Python scripts.

Extending test functionality

If complexity of our test cases exceeds testIDEA capabilities, we can extend tests with Python functions, which offer us full flexibility of a programming language. For example, if function on target calculates Fourier transform of a signal, it is very tedious to type values one by one into test specification. By implementing verification with Python script, we can verify calculations done on the target by independent Python calculation.

isystem.test contains several points during test execution, where custom scripts can be executed. They can be used to:

Instructions for implementation and usage of script extensions are given in section Writing Script Extensions.