I’m trying to create embedded unit tests for my Arduino Nano ESP32 project. Running the app itself works just fine. Here is the output I get when trying to run tests.
* Executing task in folder freeRTOS_test: C:\Users\Mnemosyne\.platformio\penv\Scripts\platformio.exe test --environment arduino_nano_esp32
Verbosity level can be increased via `-v, -vv, or -vvv` option
Collected 1 tests
Processing test_embedded in arduino_nano_esp32 environment
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Building & Uploading...
Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)
Cannot configure port, something went wrong. Original message: OSError(22, 'A device which does not exist was specified.', None, 433)
----------------------------------------------------------------------------------------- arduino_nano_esp32:test_embedded [PASSED] Took 8.81 seconds -----------------------------------------------------------------------------------------
================================================================================================== 0 test cases: 0 succeeded in 00:00:08.813 ==================================================================================================
Here is the full platformio.ini file. I have also tried setting the test_port value to different COM ports without any help.
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:arduino_nano_esp32]
platform = espressif32
board = arduino_nano_esp32
framework = arduino
monitor_speed = 115200
build_flags =
-Wall
-Wextra
-Werror
Here is my minimal test/test_embedded/test_main.cpp file.
#include <Arduino.h>
#include <unity.h>
#include <am2320.h>
void setUp(void) {
// set stuff up here
}
void tearDown(void) {
// clean stuff up here
}
void test_addition(void) {
TEST_ASSERT_EQUAL(32, 25 + 7);
}
void setup() {
// NOTE!!! Wait for >2 secs
// if board doesn't support software reset via Serial.DTR/RTS
delay(2000);
Serial.printf("TEST");
UNITY_BEGIN();
RUN_TEST(test_addition);
UNITY_END();
}
void loop() {
}
When I try to run the tests the “TEST” string prints in serial so it clearly manages to upload to the device.
--- Terminal on COM4 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
TEST
Would appreciate any help figuring this out.



