Page 1 of 1

基于idf的应用层代码,怎么做软件单元测试?

Posted: Wed Feb 27, 2019 8:59 am
by jason2
基于idf的应用层代码,怎么做软件单元测试?乐鑫有现成的单元测试的环境吗?

Re: 基于idf的应用层代码,怎么做软件单元测试?

Posted: Wed Feb 27, 2019 12:45 pm
by ESP_igrr
Please check this example project: examples/system/unit_test

Re: 基于idf的应用层代码,怎么做软件单元测试?

Posted: Thu Mar 21, 2019 8:03 am
by jason2
这个例子中,怎么给函数打桩呢?

Re: 基于idf的应用层代码,怎么做软件单元测试?

Posted: Thu Mar 21, 2019 12:53 pm
by ESP_igrr
Sorry, we don't have any out of the box support for this, yet. You can look into tools such as CMock for this purpose. If you use the new CMake build system in IDF, it should be easy to integrate a call to CMock into your CMakeLists.

Re: 基于idf的应用层代码,怎么做软件单元测试?

Posted: Fri Mar 22, 2019 2:36 am
by jason2
请问如何统计代码覆盖率呢?

Re: 基于idf的应用层代码,怎么做软件单元测试?

Posted: Fri Mar 22, 2019 4:55 am
by ESP_igrr
This is possible using app_trace and OpenOCD. Please refer to https://github.com/espressif/esp-idf/tr ... ystem/gcov.