Page 1 of 1

Writing tests for a component

Posted: Tue May 30, 2017 5:43 pm
by yaqwsx
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?

Re: Writing tests for a component

Posted: Mon Jun 12, 2017 1:54 pm
by heyinling
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.