PlatformIO Community

Please help me understand how I can do TDD in PlatformIO

Edit: Wow, wouldn’t you know I begin understanding this after I gave in and wrote a post asking for help. See my reply(or replies) for what I’ve found out on my own. I decided rather than removing my questions I will keep them for posterity.

Hello everyone. I feel some context is valuable here so I’ll share some of that before I get into my questions.

Context
I am a test architect born out of a software engineer in my day job. I’ve always enjoyed building DIY electronics kits, so I figured it was high time I check out the microcontroller and embedded device scene. Somewhat unusually, I have no interest in using this to learn programming as seems to be the primary use-case for it. Instead, I have been trying to find the best way to do serious microcontroller development work - just to quench my own curiosity - which is how I found PlatformIO.

IMO, the Arduino IDE isn’t suited for serious development work for many reasons, but my primary gripes are lack of test tooling and poor intellisense/multi-file editing. Upon digging deeper, I found Atmel Studio 7. I decided against using it because it’s Windows only and seems to be an offender of platform lock-in behavior. PlatformIO seems to be a nice project that mixes the two well. It has good Unit Test support, ability to run in a CICD pipeline, and is of course open source and trying to break free from platform lock-in.

If some of the things I ask for don’t exist or haven’t been considered I certainly don’t mind contributing to the PlatformIO project, but I get the feeling my questions come from me not understanding the domain well enough yet. I will admit that C/C++ is not my area of expertise and when I’ve looked into testing capabilities in the past I have always seemed to find they aren’t great so maybe some of my issues are related to that cultural difference (Python is my preferred language actually, but I also do lots of Node and Java).

Questions

Note that all of my questions are intentionally worded generically. If you must know, I’m currently on a Windows PC using an ATTiny85 & Tiny AVR programmer. I also have an Arduino Uno & Arduino Mega 2560. I also have Linux and Mac dev environments.

  1. Do you think PlatformIO is what I’m looking for? Perhaps it’s really not meant for “serious” work as I described it?
  2. Is there a guide/docs of any kind that may be helpful to get one started using TDD (Test Driven Development) on microcontrollers/does the TDD concept even exist in the microcontroller space yet?
  3. Is there a way to Unit Test locally without the need of a microcontroller programmer being plugged in? Ideally what I’m hoping for is to use mocking/stubbing and running locally as x86/64 (then having the ability to also run them on the real hardware ideally).
  4. If that’s not possible, perhaps I could use a simulator of some kind? (I’ve found the docs on simavr and an even more obscure WizIO but couldn’t work out how to use it without still involving a physical microcontroller)
  5. If running tests requires uploading to a microcontroller, how does the CICD pipeline integration work? Are Unit Tests ran as part of the pipeline?
  6. Are Unit Tests included directly within the binary sent to the device or are they built locally then ran over a debugging protocol on the device?
  7. If Unit Tests are included directly within the binary, it seems like this could have not inconsequential impacts to processing speed and available memory, invalidating test results? Is there a way to build the project without tests/run the tests externally?

Seems I have figured out some of this on my own…

  1. Seems to be the answer is yes - by specifying native as the platform.
  2. Short answer seems to be no (and somewhat invalidates question 7). See here. After I continue learning for myself I will update with better instructions