Running the tests require the environment variable ZEPHYR_BASE to be set.
Twister Testsuite are located in $ZEPHYR_BASE/scripts/tests directory with all the data files in $ZEPHYR_BASE/scripts/test_data directory.
Install all the dependencies using
pip install -r $ZEPHYR_BASE/scripts/requirements-build-test.txt
The testcases can be executed from the root directory using
The coverage for all the tests can be run using the command below. This will collect all the tests available.
coverage run -m pytest $ZEPHYR_BASE/scripts/tests/twister/
Then we can generate the coverage report for just twister script using
coverage report -m $ZEPHYR_BASE/scripts/pylib/twister/
To generate the coverage report for twister script use below command
coverage report -m $ZEPHYR_BASE/scripts/twister
The html coverage report for twister can be generated using
coverage html twister
If needed,the full coverage html report can be generated in every run of “pytest” in the tests directory using configuration file (setup.cfg).