diff --git a/docs/development.rst b/docs/development.rst index 4d24a8d48252bdfa9a7a79dc9b50b4cccb70b91b..c8e79719effaebf56d163994f6664303c2947b04 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -57,8 +57,8 @@ performing the following steps: pip-sync -Running role tests ------------------- +Running role tests directly +--------------------------- Role tests are implemented using `Molecule `_, `Testinfra `_, `VirtualBox @@ -68,6 +68,10 @@ of Pyhton virtual environment, while *VirtualBox* and *Vagrant* need to be installed distribution-wide, following instructions outlined on their corresponding websites. +Tests can be run directly for a single role, or for one or more roles using a +dedicated shell script (see below). The shell script can also be used for +generating reports in an automated environment. + In order to run tests for a specific role, perform the following steps: 1. Switch to Python virtual environment:: @@ -91,6 +95,36 @@ In order to run tests for a specific role, perform the following steps: molecule test --platform debian-stretch64 +Running role tests via shell script +----------------------------------- + +In order to make it easier to run tests for all roles, and eventually produce +reports of such runs, a dedicated shell script is provided for running the +tests. + +In order to run tests, perform the following steps: + +1. Switch to Python virtual environment:: + + workon majic-ansible-roles + +2. Make sure you are within the root directory of Git repository. + +3. Run tests for all roles and generate report:: + + ./scripts/run_tests.sh -r all + + .. note:: + Optionally you can run tests for a specific set of roles, or without + generating the report, for example ``./scripts/run_tests.sh web_server + common`` + +4. Check results either from script output, or within directory + ``test_report-YYYY_MM_DD-hh_mm_ss``. For overview of what roles have failed, + have a look at ``summary.txt``. For details have a look at each role's + individual report. + + .. _testsite: Test Site