No output when testing

Hi everyone, I could do with some help.

I’m not seeing any output for my unit tests and I don’t know why. I am using the PlatformIO plugin for VS code. I have a fresh install of PlatformIO and have set up a blank project and followed the tutorial here. I’m using the arduino nano (new) board. The test is compiling, uploading and running as I see the LED flashing 5 times, I just don’t see any output past

If you don't see any output for the first 10 secs, please reset board (press reset button)

I can however compile and upload a main.cpp program that outputs text in the same environment. Also I’ve run unit tests before with this same setup with no issues. Tests just stopped outputting for some reason :confused:

When I inspect the code, I see UNITY_BEGIN() eventually calls UNITY_OUTPUT_START(). I would have thought this is where serial output is initialised, but it’s defined as nothing:


my platformio.ini:

platform = atmelavr
board = nanoatmega328new
framework = arduino

platform = teensy
framework = arduino
board = teensy31

I had a similar issue with GTEST some time ago, here are some suggestions to get started with troubleshooting:

  • Check if the object files are generated (which should be the case, as you stated your test initiates OK). Files should be located in .pio/build/nanoatmega328new/test/nanoatmega328new
  • For certain errors, the test itself will just crash without any notification about that or why this happened. Example is a segmentation fault (this is was what happened to me using GTEST and some unnecessary "delete"s on pointers :wink: - I just figured it out when running the executable in a console application…)

Your error looks like the test cannot yield the results to display to your terminal.
To investigate, please write a trivial assert right as first and last tests like
void trivialTest(void) {

At least the first trivial test should be printed to console if your test crashes due to your implementation of business logic.

In case this does not help, please share a minimal code example that reproduces your error so the community can contribute.

1 Like

Another possibility are wrong / divergent settings for transfer rates. I’ve made the experience that is a good practice to fix transmission rate in platformio.ini

platform = espressif8266
board = d1_mini

as well as in your code

void setup() {

If I alter the value for test_speed to a value other than that used in code I observe the same phenomenon like you

1 Like

Right you are!
Same issue arises if you tamper with fuses to change the clock speed, as some libraries have Arduino’s typical Quarz’ed 16Mhz clock hardcoded.
Library/ user code do not realize that the baudrate changes with system clock.
Did not do this with platformio yet, but it was a major hassle to get some Arduino projects running on internal RC oscillator with 1Mhz (on Atmel Studio).

1 Like

This is where alternative cores like MiniCore (which you can use in either PlatformIO or Arduino IDE :wink: ) really shine, as it natively supports 1Mhz clock via the internal oscillator… haven’t tried it myself, but if MCUdude says it works, I believe it!

1 Like

Available time for playing around is a problem here; but I will definetely validate that when it fits one of my projects… :sunglasses:

1 Like

My shelves of unfinished projects agree with you on that! :laughing: