4 ms·
Ask HN: Unit testing techniques for embedded systems
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?
- viraptor 8y agoWhat 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 8y agoI’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?
- avian 8y ago"Test-Driven Development for Embedded C" by James W. Grenning. https://pragprog.com/book/jgade/test-driven-development-for-embedded-c https://pragprog.com/book/jgade/test-driven-development-for-... It's very well written and I've used the unit testing approaches described there in several projects.
- matt_the_bass 8y agoThat looks great! Thanks for the recommendation.