zephyr/tests/ztest/fail
Anas Nashif cec8fd1c6e tests: ztest: fix tags for testsuite and unify them
Use test_framework as unified tag so we can filter tests in a consistent
way.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04:00
..
core treewide: Update deprecated CONFIG_LIB_CPLUSPLUS usages 2023-01-13 17:42:55 -05:00
src ztest: add framework tests for failed states 2022-08-29 10:27:00 +02:00
CMakeLists.txt ztest: add framework tests for failed states 2022-08-29 10:27:00 +02:00
Kconfig ztest: fix grammar for errors in bad test phases 2022-10-13 06:40:31 -04:00
prj.conf treewide: Update deprecated CONFIG_LIB_CPLUSPLUS usages 2023-01-13 17:42:55 -05:00
README.rst ztest: add framework tests for failed states 2022-08-29 10:27:00 +02:00
testcase.yaml tests: ztest: fix tags for testsuite and unify them 2023-06-02 04:47:06 -04:00

.. _ztest_framework_failure_tests:

Ztest framework failure tests
#############################

Overview
********

In order to test the actual framework's failure cases, this test suite has to do something unique.
There's a subdirectory to this test called 'core'. This project builds a sample ``native_posix`` or
``unit_testing`` binary which is expected to fail by calling one of the following:
- ``ztest_test_fail()`` during either the ``after`` or ``teardown`` phase of the test suite
- ``ztest_test_skip()`` during either the ``after`` or ``teardown`` phase of the test suite
- ``ztest_test_pass()`` during either the ``after`` or ``teardown`` phase of the test suite

Note that these can be called indirectly through failed asserts or assumptions.

The binary by itself, when executed, will fail to run and return a code of ``1``. The main test
binary will use ``popen()`` to run the failing test binary and will assert both the return code and
the output. The output itself cannot be printed to the log as it will confuse ``twister`` by
reporting a failure.