Zephyr ztest

From Wiki at Neela Nurseries
Revision as of 21:20, 11 November 2025 by Ted (talk | contribs) (Inline CSS minor adjust up for font size)
Jump to navigation Jump to search

Overview

Zephyr has extensive documentation on its ztest and "twister" framework. As an aside however, to understand a pattern "Arrange, Act, Assert" test organization see the Zephyr 3.7.0 source file ``zephyrtests/net/lib/lwm2m/block_transfer/src/main.c``.

Topic - Ztest suite macro

Macro ZTEST_SUITE() described at https://docs.zephyrproject.org/3.7.0/develop/test/ztest.html#c.ZTEST_SUITE. The signature of this function like macro is:

ZTEST_SUITE(SUITE_NAME, PREDICATE, setup_fn, before_fn, after_fn, teardown_fn)

Topic - example tests

https://github.com/zephyrproject-rtos/zephyr/tree/main/tests/application_development/code_relocation