Running Project Tests#
The project employs two testing frameworks, specifically Pytest for python executed tests and Google Test for C/C++ executed tests.
To run all tests execute the following from the project root directory
python run_all_test.py
To run only the python test use the following commands.
cd src
pytest
To run only the C/C++ tests use
cd src
ctest
cd dist3
ctest -C <Release or Debug>
Running Tests In Parallel#
One can distribute python tests across multiple processes. This is achieved with the pytest-xdist
package using
pip3 install pytest-xdist
After installing this package you can now pytest such that it distribute tests across multi-processes.
pytest for the same number of processes as processors on the host machine using
python3 -m pytest -n auto
or replace auto with the number of processors (virtual or otherwise) you’d like to dedicate as test executions processes.
The C/C++ (Google Test) tests can likewise be distributed across multiple processes by passing
--parallel to ctest
ctest --parallel <N>
where <N> is the number of test processes to run concurrently (alternatively, set the
CTEST_PARALLEL_LEVEL environment variable). run_all_test.py already runs the C/C++ tests in
parallel automatically, scaling to the number of processors on the host machine.
Generating HTML Report of the pytest Results#
If you want to use pytest to generate a validation HTML report,
then the pytest-html package must be installed
pip3 install pytest-html
When running pytest from the terminal, add the --html argument followed by the path to where
to generate the report html folder. It is recommended to put this inside a folder as HTML
support folder will be created
pytest --html report/report.html