Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit testing for embedded C development [closed]

Dumb question: what unit test framework do you use for embedded development? There are was a question about unit test frameworks for C, but it was old, and not embedded oriented.

like image 905
Penguinolog Avatar asked Jun 17 '13 11:06

Penguinolog


1 Answers

If I only take this part of your question : What unit test framework 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 all our embedded development: TI C67x DSP (production code is 100% C, we use only C++ for gtest), VxWorks on x86 and Linux on ARM.

Edit: You wrote in your comments that your platform is an ATMega. I do not think gtest will fit in a 8 bits MCU, even a big one. You may have two solution:

  • If you have a lot of code that is independent from the MCU hardware itself, you can try to test this code on a computer, mocking (i.e. simulating) the hardware-related parts. This solution will only make unit tests (not integration tests), requires your code to have a clear frontier between what is tightly related to the hardware and between what is not...
  • Try a testing framework explicitly designed for MCU. µCUnit documentation seems clear, I have never tried it... it may worth the try.
like image 64
Matthieu Rouget Avatar answered Sep 29 '22 07:09

Matthieu Rouget