PlatformIO Community

Unit tests for PIO library

From this post, I’m trying to understand how to run unit tests only on a library (under the lib directory). Any tests in the ./lib/my_lib/test directory aren’t detected and don’t run when testing the project.

  • lib
    ---- include
    ---- src
    ---- test (Files not found)
  • include
  • src
    – main.cpp
  • test (OK tests are working)

Do I need a separate platformio.ini in each library that I want tests in?


PIO Unit Testing engine works with projects. You can write tests in a project that cover logic of your libraries/components. See example