Writing tests for a component

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

Writing tests for a component

Postby yaqwsx » Tue May 30, 2017 5:43 pm

I am writing a component in C++ and I would like to test it. So according to the documentation, I created a directory test and wrote a simple test there in a .c file. How should I now run the test of my component using unit-test-app?

Also, I have noticed there some tests written in the Catch framework, which is included in ESP-IDF. How can I use it to write C++ tests of my component?

heyinling
Posts: 19
Joined: Thu Mar 23, 2017 7:21 am

Re: Writing tests for a component

Postby heyinling » Mon Jun 12, 2017 1:54 pm

Hi,

I've wrote some C unit test cases according to the doc http://esp-idf.readthedocs.io/en/latest ... tests.html.

after adding cases, you need to do `make flash TESTS_ALL=1` or `make TEST_COMPONENTS='xxx'` to build unit-test-app and flash to target board. then open the serial console, reboot the board, it will print the test menu which contains all built test cases.
then input index of test case in test menu, or quoted test case name ("test case name"), plus Enter, it will run the case and report test result.

Who is online

Users browsing this forum: No registered users and 81 guests