Lines Matching +full:reset +full:- +full:on +full:- +full:invalid +full:- +full:access

1 .. _test-framework:
19 * ``suite_name`` - The name of the suite. This name must be unique within a single binary.
20 * :c:type:`ztest_suite_predicate_t` - An optional predicate function to allow choosing when the
23 * :c:type:`ztest_suite_setup_t` - An optional setup function which returns a test fixture. This
25 * :c:type:`ztest_suite_before_t` - An optional before function which will run before every single
27 * :c:type:`ztest_suite_after_t` - An optional after function which will run after every single
29 * :c:type:`ztest_suite_teardown_t` - An optional teardown function which will run at the end of
34 .. code-block:: C
41 return ((const struct test_state*)global_state)->x == 5;
51 * :c:macro:`ZTEST` ``(suite_name, test_name)`` - Which can be used to add a test by ``test_name`` t…
53 * :c:macro:`ZTEST_P` ``(suite_name, test_name)`` - Add a parameterized test to a given suite by spe…
54 the ``suite_name`` and ``test_name``. You can then access the passed parameter within
56 * :c:macro:`ZTEST_USER` ``(suite_name, test_name)`` - Which behaves the same as :c:macro:`ZTEST`, o…
59 * :c:macro:`ZTEST_F` ``(suite_name, test_name)`` - Which behaves the same as :c:macro:`ZTEST`, only
62 * :c:macro:`ZTEST_USER_F` ``(suite_name, test_name)`` - Which combines the fixture feature of
69 the same suite will require some initial setup followed by some form of reset between each test.
72 .. code-block:: C
88 fixture->max_size = 256;
96 memset(fixture->buff, 0, fixture->max_size);
97 fixture->size = 0;
109 zassert_equal(0, fixture->size);
110 zassert_equal(256, fixture->max_size);
128 .. code-block:: C
155 where you might want to reset some state for every test in the binary (regardless of which suite is
156 currently running). As an example, this could be to reset mocks, reset emulators, flush the UART,
159 .. code-block:: C
185 state that the tests depend on and that state either cannot be replicated or is difficult to
187 Assuming there's a board with several steps in the power-on sequence a test suite can be written
191 .. code-block:: C
218 Quick start - Integration testing
229 .. code-block:: console
231 ./scripts/twister -T tests/foo/bar/
233 To select just one of the test scenarios, run Twister with ``--scenario`` command:
235 .. code-block:: console
237 ./scripts/twister --scenario tests/foo/bar/your.test.scenario.name
244 on how Twister deals with Ztest application.
290 .. code-block:: C
308 test applications or a subset of them, and can generate reports on a granular
314 .. code-block:: console
316 ./scripts/twister --list-tests -T tests/kernel
321 Special- or architecture-specific tests cannot run on all
325 conditionals inside the test suite is sub-optimal. Tests that need
330 .. code-block:: C
354 Quick start - Unit testing
369 .. code-block:: cmake
378 depends on, you have to provide function stubs in the test. Ztest provides
400 as passed, failed, blocked, or skipped. Reporting on only the
401 high-level test application, particularly when tests do too
406 - Why not pre-scan with CPP and then parse? or post scan the ELF file?
408 If C pre-processing or building fails because of any issue, then we
411 - Why not declare them in the YAML test configuration?
415 themselves -- only one file to update when changes are made
428 (each on different priority), optionally starting a timer. For each context, a user
432 the system clock frequency should be relatively high. The default 100 Hz on QEMU x86
457 .. code-block:: C
469 - :kconfig:option:`CONFIG_ZTRESS_MAX_THREADS` - number of supported threads.
470 - :kconfig:option:`CONFIG_ZTRESS_STACK_SIZE` - Stack size of created threads.
471 - :kconfig:option:`CONFIG_ZTRESS_REPORT_PROGRESS_MS` - Test progress report interval.
491 ``zassert_equal(buf->ref, 2, "Invalid refcount")``:
493 .. code-block:: none
495 … Assertion failed at main.c:62: test_get_single_buffer: Invalid refcount (buf->ref not equal to 2)
512 .. code-block:: C
514 zexpect_equal(buf->ref, 2, "Invalid refcount");
515 zexpect_equal(buf->ref, 1337, "Invalid refcount");
519 .. code-block:: none
521 START - test_get_single_buffer
522 …Expectation failed at main.c:62: test_get_single_buffer: Invalid refcount (buf->ref not equal to 2)
523 …Expectation failed at main.c:63: test_get_single_buffer: Invalid refcount (buf->ref not equal to 1…
524 FAIL - test_get_single_buffer in 0.0 seconds
538 ``zassume_equal(buf->ref, 2, "Invalid refcount")``:
540 .. code-block::none
542 START - test_get_single_buffer
543 … Assumption failed at main.c:62: test_get_single_buffer: Invalid refcount (buf->ref not equal to 2)
544 SKIP - test_get_single_buffer in 0.0 seconds
555 .. _mocking-fff:
563 .. code-block:: C
567 Zephyr provides several FFF-based fake drivers which can be used as either stubs or mocks. Fake
571 - :dtcompatible:`zephyr,fake-can`
572 - :dtcompatible:`zephyr,fake-eeprom`
575 See :ref:`FFF Extensions <fff-extensions>`.
589 .. code-block:: C
600 be dependent on this sequence. Enable :kconfig:option:`CONFIG_ZTEST_SHUFFLE` to
603 twister with ``--seed``.
624 .. code-block:: bash
626 $ zephyr.exe -list
627 $ zephyr.exe -test="fixture_tests::test_fixture_pointer,framework_tests::test_assert_mem_equal"
628 $ zephyr.exe -test="framework_tests::*"
631 .. _fff-extensions: