PlatformIO Community

Unity unit tests dependencies

Hello,

I have recently started setting up unit testing for a mature project based on PlatformIO, nrf52832 custom board with Adafruit framework. I am having trouble with compiling and running the tests using Unity testing framework with native setup. The simple unit test that I create struggles to find bluefruit.h which is present in the platformIO environment. How do I include this library in the testing environment?

image

On native, by default, you don’t magically have access to the Arduino core implementation or header files that your embedded device is using. You can however mock the Arduino core and libraries, see reference example. Mocking the Bluefruit library is however not included in ArduinoFake.

You might also want to take a look at gmock.

1 Like

Thank you so much! I’ll take a look at ArduinoFake. It also seems like FakeIt on which ArduinoFake is based on could potentially help with mocking Bluefruit library.