mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
ESP Matter Unit Test App
This application runs unit tests for the ESP Matter component using the Unity test framework.
Unity Test Framework
This test app uses the Unity Test Framework suggested by ESP-IDF.
Further reads:
Running the Tests
- Build the application:
cd examples/unit_test_app
idf.py build
- Flash to device:
idf.py -p <PORT> flash monitor
- Run tests: Once flashed, the test menu will appear in the serial monitor. You can:
- Press
Enterto see the list of available tests - Enter a test number to run a specific test
- Enter
*to run all tests
Extending the Tests
Adding tests to existing component
- Create a new
.cppfile incomponents/<component_name>/test/ - Add the filename to the source list in
components/<component_name>/test/CMakeLists.txt:
list(APPEND srcs_list "your_new_test_file.cpp")
- Write the test cases in the new test file.
Adding new component tests
Please refer to components/esp_matter/test directory for comprehensive structure and example.
- After adding the new component tests, you need to add the component to the TEST_COMPONENTS list in CMakeLists.txt
- Append the component name to the TEST_COMPONENTS list. For example, if you add a new component called "new_component", you need to add it to the TEST_COMPONENTS list in CMakeLists.txt:
set(TEST_COMPONENTS "esp_matter new_component" CACHE STRING "List of components to test")