Platformio doesn't compile cpp files from subfolders in test folder

Hello,
I’m trying to setup googletest framework. When I’m running tests, googletest isn’t see tests from subfolders. When I manually include tests to setup.cpp file or move tests from subfolder to test folder, everything works.

The to be tested components and tests have to be layed out in a specific folder structure, otherwise things won’t get compiled – check the resources at Unit tests, Platformio, googletest, errors, linking - #2 by maxgerhardt

Part of my folder structure(I think, that it is correct):
image

EDIT: when Setup.cpp and test.cpp is in UnitTests folder, platformio doesn’t compile any of these files. When I move Setup file into test folder, platformio googletest doesn’t see any tests from test.cpp file.

No, it is not correct. See Test Hierarchy — PlatformIO latest documentation

You need to create a minimum of one test suite where the folder starts with the test_ prefix.

1 Like