How to properly write tests? How to use ttfw_idf?

yaqwsx
Posts: 5
Joined: Sun Feb 26, 2017 9:05 am

How to properly write tests? How to use ttfw_idf?

Postby yaqwsx » Tue Aug 03, 2021 8:17 pm

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?

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

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

Postby ESP_igrr » Fri Aug 06, 2021 12:34 pm

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.

Who is online

Users browsing this forum: Baidu [Spider] and 54 guests