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

jason2
Posts: 44
Joined: Thu Oct 26, 2017 11:02 am

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

Postby jason2 » Wed Feb 27, 2019 8:59 am

基于idf的应用层代码,怎么做软件单元测试?乐鑫有现成的单元测试的环境吗?

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

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

Postby ESP_igrr » Wed Feb 27, 2019 12:45 pm

Please check this example project: examples/system/unit_test

jason2
Posts: 44
Joined: Thu Oct 26, 2017 11:02 am

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

Postby jason2 » Thu Mar 21, 2019 8:03 am

这个例子中,怎么给函数打桩呢?

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

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

Postby ESP_igrr » Thu Mar 21, 2019 12:53 pm

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.

jason2
Posts: 44
Joined: Thu Oct 26, 2017 11:02 am

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

Postby jason2 » Fri Mar 22, 2019 2:36 am

请问如何统计代码覆盖率呢?

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

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

Postby ESP_igrr » Fri Mar 22, 2019 4:55 am

This is possible using app_trace and OpenOCD. Please refer to https://github.com/espressif/esp-idf/tr ... ystem/gcov.

Who is online

Users browsing this forum: No registered users and 186 guests