Page 1 of 1

Unit tests for main app

Posted: Thu Oct 31, 2019 7:31 pm
by Arthedian
Hello,

I am using ESP32 with esp-idf. I found out, that there is possible to add unit tests for components. Is it possible to add unit tests for the main app?

Re: Unit tests for main app

Posted: Wed Apr 27, 2022 1:59 pm
by dmitrij999
It's needed for me as well

Re: Unit tests for main app

Posted: Sun May 22, 2022 9:08 am
by dmitrij999
As I understood, the approach putting you logic into one monolite file is NOK, as it becomes hard-to-read.

I propose to divide your code into components, compose Kconfig files for each of components, then your code becomes unit-testable.

P.S. By the way, when I refactored my code and injected unit-tests, I managed to see and solve some unobvious bugs

Re: Unit tests for main app

Posted: Mon May 23, 2022 9:29 am
by ashelman-ec
FYI all,

For anyone looking for details on how to implement unit tests, refer to Espressif's examples / system / unit_test project.

For those using VS Code with the Espressif IDF extension, refer to this post for details on how to run the tests.

Re: Unit tests for main app

Posted: Tue Sep 17, 2024 3:10 am
by tank104
That example doesn't show how to test code in "main" - it doesn't seem possible.

Is it?