Unit-testing Test Runner

I got recently drawn to platformio for their unit-testing framework and CI pipeline. Two features I’ve been looking for in my embedded coding projects.

I’ve digested the tutorials and examples and there seems to be quite a number of gotchas, .e.g. understanding how the test runner works. If I’m looking a full suite of tests for my OO class methods. What’s the best way to go about structuring the files in /test?

I’ve tried several ways but it seems like the only way is to individually have each test in its own folder. So say /uno_car/test_car, /uno_moped/test_moped.

Is there a way to have several tests grouped in the same folder, .e.g say /uno/moped/test_moped.cpp, /uno/test_car/test_car.cpp because currently it is throwing errors about having initialized setup twice. Any thoughts/suggestions?

Yes, new folder in test means “complete project” with own main/setup/loop. So, it helps developers to write multi-files test with a single entry point.

1 Like