Trouble unit testing with esp32 esp-idf

I am having issues getting when trying to run unit tests using the esp32 and the esp-idf framework. In attempting to get this working I have adapted the calculator unit test example provided but have had no success. I have the project building and uploading successfully but when running embedded tests this is the output.

Processing test_embedded in esp32dev environment
------------------------------------------------------------------------------
Building...
Uploading...
Connecting......
Writing at 0x00001000... (100 %)
Wrote 23024 bytes (14383 compressed) at 0x00001000 in 0.3 seconds (effective 563.3 kbit/s)...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 2736.3 kbit/s)...
Writing at 0x00010000... (20 %)
Writing at 0x00020000... (100 %)
Wrote 153680 bytes (78068 compressed) at 0x00010000 in 1.8 seconds (effective 694.2 kbit/s)...
Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)

No output occurs after this and pressing the reset button does nothing. Im not sure what I am doing wrong and was wondering if I could get any help with solving this problem.

platformio.ini

[env:esp32dev]
platform = espressif32
framework = espidf
board = esp32dev
test_ignore = test_desktop
monitor_speed = 115200
monitor_flags = --raw

test_calculator.c

#include <calculator.h>
#include <unity.h>

void test_function_calculator_addition(void) {
    TEST_ASSERT_EQUAL(32, addesp(25, 7));
}

void test_function_calculator_subtraction(void) {
    TEST_ASSERT_EQUAL(20, subesp(23, 3));
}

void test_function_calculator_multiplication(void) {
    TEST_ASSERT_EQUAL(50, mulesp(25, 2));
}

void test_function_calculator_division(void) {
    TEST_ASSERT_EQUAL(32, divesp(100, 3));
}

void app_main()
{
    UNITY_BEGIN();
    RUN_TEST(test_function_calculator_addition);
    RUN_TEST(test_function_calculator_subtraction);
    RUN_TEST(test_function_calculator_multiplication);
    RUN_TEST(test_function_calculator_division);
    UNITY_END();
}

Any suggestions? There are no examples for this scenario, only unit testing with arduino framework.

Your app_main() directly runs the unit tests without any delay. PlatformIO may have simply missed the output.

What’s the output when conecting to the serial monitor as usual and pressing the reset button?

1 Like