Unit tests for main app

Arthedian
Posts: 4
Joined: Fri Mar 23, 2018 1:09 pm

Unit tests for main app

Postby Arthedian » Thu Oct 31, 2019 7:31 pm

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?

dmitrij999
Posts: 71
Joined: Sat Mar 02, 2019 8:06 pm

Re: Unit tests for main app

Postby dmitrij999 » Wed Apr 27, 2022 1:59 pm

It's needed for me as well

dmitrij999
Posts: 71
Joined: Sat Mar 02, 2019 8:06 pm

Re: Unit tests for main app

Postby dmitrij999 » Sun May 22, 2022 9:08 am

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

ashelman-ec
Posts: 9
Joined: Fri May 13, 2022 6:08 am

Re: Unit tests for main app

Postby ashelman-ec » Mon May 23, 2022 9:29 am

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.

tank104
Posts: 5
Joined: Mon May 06, 2024 9:45 pm

Re: Unit tests for main app

Postby tank104 » Tue Sep 17, 2024 3:10 am

That example doesn't show how to test code in "main" - it doesn't seem possible.

Is it?

Who is online

Users browsing this forum: Bing [Bot] and 342 guests