
Ask HN: Unit testing techniques for embedded systems - matt_the_bass
Hi all, I’ve found unit tests to be fantastic tools for general OS based programming. However, I’ve often struggled to replicate these tools in embedded systems. Can anyone make any recommendations or suggest a good reference?
======
avian
"Test-Driven Development for Embedded C" by James W. Grenning.

[https://pragprog.com/book/jgade/test-driven-development-
for-...](https://pragprog.com/book/jgade/test-driven-development-for-
embedded-c)

It's very well written and I've used the unit testing approaches described
there in several projects.

~~~
matt_the_bass
That looks great! Thanks for the recommendation.

------
viraptor
What do you mean by embedded systems? What environment / language / ...?

Generally you should be able to achieve a lot of unit testing by writing
system-independent code and moving all real-world interactions into a thin,
simple layer. It may require specific restrictions though (for example using
stdint types in case of C so that they don't change when testing locally)

~~~
matt_the_bass
I’m asking generically, but currently I’m working with an ADI Blackfin 537
tightly coupled with components on custom hardware. It used ADI’s VDK
“operating system” with mostly C but with a little C++ and ASM.

I can easily understand platform independant testing for calculation type
tests. But how to handle hardware timing type tests?

