Unit tests

Important

The Asset Tracker v2 application is in maintenance mode. For new projects, it is recommended to use the Cellular: nRF Cloud multi-service sample instead.

The internal modules of the Asset Tracker v2 application have a set of unit tests in the asset_tracker_v2/tests folder. Following are the modules that have unit tests:

  • Debug module - asset_tracker_v2/src/modules/debug_module.c

  • User Interface module - asset_tracker_v2/src/modules/ui_module.c

  • Location module - asset_tracker_v2/src/modules/location_module.c

  • JSON common library - asset_tracker_v2/src/cloud/cloud_codec/json_common.c

  • LwM2M codec helpers - asset_tracker_v2/src/cloud/cloud_codec/lwm2m/lwm2m_codec_helpers.c

  • LwM2M integration layer - asset_tracker_v2/src/cloud/lwm2m_integration/lwm2m_integration.c

  • nRF Cloud codec backend - asset_tracker_v2/src/cloud/cloud_codec/nrf_cloud/nrf_cloud_codec.c

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 asset_tracker_v2/tests/debug_module.

The unit tests can be executed using west or Twister. For more information, see Running unit tests, and in particular the example for nRF9160 DK.