Unit Testing C Embedded Development

Dumb question: what is the unit test structure you use for embedded development? There was a question about unit test frameworks for C, but it was old and not built-in oriented.

+7
source share
2 answers

If I just take this part of your question: What unit test structure do you use for embedded development ?, then I answer Google Test. It requires a C ++ compatible compiler, but is suitable for testing C code.

We use it for our entire embedded development: TI C67x DSP (production code 100% C, we use only C ++ for gtest), VxWorks on x86 and Linux on ARM.

Change You wrote in your comments that your platform is ATMega. I don't think gtest will fit in an 8-bit MCU, even a large one. You can have two solutions:

  • If you have a lot of code that is independent of the MCU hardware itself, you can try testing this code on your computer, taunting (for example, simulating) hardware-related parts. This solution will only perform unit tests (and not integration tests), it requires that your code have a clear boundary between what is closely related to hardware and what is not ...
  • Try a test framework specifically designed for the MCU. The ΞΌCUnit documentation seems clear, I have never tried it ... it might be worth a try.
+7
source

Try this option - MinUnit - the smallest unit testing platform for C

Simple but very comfortable

+1
source

All Articles