Unit test suggestions

Are there any particular unit test libraries or approaches that are well suited to PlatformIO?

PlatformIO 3.0 has support for hardware unit testing. See temporary 3.0 docs http://docs.platformio.org/en/feature-platformio-30/platforms/unit_testing.html

That looks promising, but I’m thinking more along the lines of traditional unit tests where you mock out elements of the software, and verify that a function is performing correctly under different inputs.

In my case, I want to replay some captured serial data through classes/functions that handle decoding it into packets and accessing the values. There are a few edge cases in the protocol that are hard to replicate using the physical hardware, and I’d like to debug the situation in the IDE.

Do you mean local unit testing on the host machine? I’ll implement it soon:

Yep, exactly.

I will use the unit tests to exercise my packet decoding and other input handling logic with various input edge-cases. In my day job I rely on debugging via unit tests to adjust a function to properly.

I think I’ll try and dig deeper into this example – cleanflight/io_serial_unittest.cc at master · cleanflight/cleanflight · GitHub

Looks like that (very popular) project uses gtest and travisci for automation. But I want to make sure I can debug a failing unit test…

Should I be able to bring up a cleanflight dev environment in platformio? Or is there project fundamentally incompatible with the way platformio works?

Please wait when I’ll close

You will be impressed :blush:

1 Like