Skip to content

Migration and road map from the deprecated testing API to the new ZTEST API. #47002

@aaronemassey

Description

@aaronemassey

Migration and road map from deprecated testing API to the current API.

Each test suite should be refactored to the new ZTEST API.

Some example API migrations

Migration status

The list below was initially generated by finding tests without a ZTEST_SUITE
macro usage and roughly categorizing them with respect to their directories and
tested features. For example, tests/application_development and
tests/arch/arm contain unmigrated tests.

Simple migration workflow

This does not cover all migration cases nor the entirety of the ZTEST API. This
is just a simple workflow get started on simple tests.

  • Replace ztest_test_suite() and its containing function with a
    ZTEST_SUITE() defined here with documented
    parameters
    .
  • Replace prior test functions invoking zassert with ZTEST or ZTEST_USER.
  • Add CONFIG_ZTEST_NEW_API=y to the test's prj.conf.

Difficulty or questions

Usually, a single test's migration shouldn't require more than 10 minutes. If
you're having difficulty porting a test or understanding how to use the new
ZTEST API, then make a comment on this issue.

Some suggestions

  • Try the new CONFIG_ZTEST_SHUFFLE to check if the ported test functions are self-contained/independent.
  • Keep the old CONFIG_MULTITHREADING as the old test cases.
  • Do not have a “test_” prefix in the test suite name.
  • One test suite per commit. One PR to hold all related commits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MetaA collection of features, enhancements or bugsarea: TestsIssues related to a particular existing or missing test

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions