The internal modules of the nRF9160: Asset Tracker v2 application have a set of unit tests in the
Following are the modules which contain unit tests:
To run the unit test, you must navigate to the test directory of the respective internal module.
For example, to run the unit test for Debug module, navigate to
The unit tests can be executed using West or Twister.
Enter the following west commands to execute the tests on different board targets:
Native POSIX execution (native_posix) board target:
west build -b native_posix -t run
west build -b qemu_cortex_m3 -t run
Enter the following twister commands to execute the tests on different board targets:
On both Native POSIX execution (native_posix) and
twister -T .
twister -T . -p qemu_cortex_m3
Running the unit tests on the nRF9160 DK
Enter the following command to execute the unit tests on nRF9160 DK:
twister -T . -p nrf9160dk_nrf9160_ns --device-testing --device-serial <serial port>
In this console snippet,
serial port must be the port where you receive logs from the DK, normally the first port listed by
nrfjprog --com, for example
testcase.yaml file for that unit test must have the entry
nrf/applications/asset_tracker_v2/tests/gnss_module/testcase.yaml for an example.
Twister can also be used to see code coverage reports. For more information about Twister, see the Test Runner (Twister) documentation.
The Twister commands only work on Linux operating system.