1. Skip to content

1. Testing Option for VSCode

You can test your functions directly on the device.

1.1 Structure

All tests are under directory "test" in the project and not compiled with default build option of platformio. The main function is in file test_suite_controlflow.cpp. In method app_main() you can add your own tests.


1.2 Include my my own test

In method app_main() of test_suite_controlflow.cpp you can add your own tests. Include your test-file in the top like

#include "components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp"

components is a subfolder of tests here. Not the components directory of root source.

In the bottom add your test function.


Your test function should have a TEST_ASSERT_EQUAL_*. For more information look at unity-testing.

1.3 Run tests

You will need a testing device. best with usb adapter. Before you upload your tests you will need to setup the device with initial setup procedure described in [[Installation]]


Now you can use Visual Studio Code or a standard console to upload the test code. In VS Code (tab platformio) open Advanced and select Test.


Alternatively you can run it in console/terminal with platformio test --environment esp32cam.

In my environment the serial terminal not opens. I have to do it for myself. You will see much logging. If any test fails it logs it out. Else it logs all test passed in the end.

1.4 Troubleshooting

If you test very much cases in one function, the device runs in Stack Overflow and an endless boot. Reduce the count of test cases or split the test function in multiple functions.