Test runner for Domogik plugins

Purpose

The test runner tool is used by continuous integration to run a set of test files for a plugin.

How it works ?

You just need to give the tool the path to the test files and it will use the tests.json file to execute some test files depending on the parameters you give to the tool.

Here are all the available options:

$ dmg_testrunner -h
usage: dmg_testrunner [-h] [-a] [-c CRITICITY] directory

Launch all the tests that don't need hardware.

positional arguments:
  directory             What directory to run

optional arguments:
  -h, --help            show this help message and exit
  -a, --allow-alter     Launch the tests that can alter the configuration of
                        the plugin or the setup (devices, ...)
  -c CRITICITY, --criticity CRITICITY
                        Set the minimum level of criticity to use to filter
                        the tests to execute. low/medium/high. Default is low.
  • –allow-alter : you must use this option with caution! It will allow to run all the tests that alter the Domogik system (change the configuration, delete and create some devices, …). This must NOT be used on a production environment!
  • –critivity <level> : set the minimum level of criticity that will be used. If set to high, only the tests tagged as high criticity in the json file will be run.

Example

In this example, there is only one test file to launch, which is named tests.

$ dmg_testrunner -a -c low /var/lib/domogik/domogik_packages/plugin_diskfree/tests/
Domogik release : 0.4.1
Running test with the following parameters:
- allow to alter the configuration or setup.
- criticity : low
- path /var/lib/domogik/domogik_packages/plugin_diskfree/tests/
- json file /var/lib/domogik/domogik_packages/plugin_diskfree/tests//tests.json
List of the tests (keep in mind that tests which need hardware will be skipped) :
[ TO RUN  ] tests : need hardware=False, alter config or setup=True, criticity=high

---------------------------------------------------------------------------------------
Launching tests
---------------------------------------------------------------------------------------

...


Tests summary :
---------------
Test tests : OK