Page 1 of 1

How to properly write tests? How to use ttfw_idf?

Posted: Tue Aug 03, 2021 8:17 pm
by yaqwsx
Hello,
I noticed that ESP-IDF uses some internal machinery for automatic running and compiling tests provided by a Python package ttfw_idf. Is there documentation for this solution? Is it possible to easily adapt it to our project?

Re: How to properly write tests? How to use ttfw_idf?

Posted: Fri Aug 06, 2021 12:34 pm
by ESP_igrr
Hi yaqwsx,
ttfw (short for tiny-test-framwork) has been used in ESP-IDF for some time, mainly to support running unit and example tests in CI. While using it, we ran into a number of limitations, most of which stem from the fact that we writing a good test framework is not a simple task, and we are hardly experts in this are. For example, ttfw we mainly built with CI in mind, and proved to be difficult or unintuitive to use locally for developers.

Recently we have started developing a set of plugins for pytest, a well known Python test framework. The goal for these plugins is to simplify testing of embedded applications. The current version of these plugins is available from https://github.com/espressif/pytest-embedded and from PyPI. If you are interested in testing some IDF applications, I recommend taking a look at the examples found here: https://github.com/espressif/pytest-emb ... es/esp-idf. If you have any problem, question, or suggestion, please open an issue in pytest-embedded repository. I think it will be easier for you to get started with pytest-embedded than with ttfw.