PlatformIO Community

Unit Testing runs with failure but summary displaying all had passed

Hi all,

I’m using Unity for running tests for Arduino.
I have tests which isn’t working well on any local environment (using vscode) since I upgraded to platformio 6.0.X.
I fixed the directories according to the new hierarchy and still I have an issue.

I’ve entered a failing assertion into the test, and expected to see it in the summary of the tests run.
When I’m running platformio test --environment pico32 -v command I see the following results:

Processing test_parsing in pico32 environment

Building & Uploading...
1 Tests 1 Failures 0 Ignored

--------------------------------------------------------------------- pico32:test_parsing [PASSED] Took 12.19 seconds --------------------------------------------------------------------- 

========================================================================================= SUMMARY ========================================================================================= 
Environment    Test               Status    Duration
-------------  -----------------  --------  ------------
pico32         test_parsing       SKIPPED   00:00:12.186
======================================================================== 0 test cases: 0 succeeded in 00:00:12.186 ======================================================================== 

the tests file code is similar to any examples file (using setup() and loop() methods) and it also works on our CI procedure.

any ideas how to fix this?


What is your platformio.ini?

this is my configuration:

board = pico32
framework = arduino
platform = espressif32
monitor_speed = 115200
build_type = release
check_tool = cppcheck, clangtidy
check_skip_packages = yes
debug_tool = esp-prog
debug_init_break = tbreak setup

For others out there that might encounter the same issue:

my tests were written in a dedicated namespace, and for some reason Unity don’t work with it well.
in order to overcome this, several solutions are possible:

  1. simplest - write the tests outside of the namespace
  2. add a function runTests() inside the namespace and call it from setup() function
1 Like