Hey all,
I'm a college student working as a software engineer at a product development/prototyping studio called Mind Studios. We use Arduinos pretty heavily for our prototypes, and we want to use as much of the functionality as possible for more esoteric prototypes (custom boards, etc.). In order to ensure we have solid code and cut down on our debugging time, we've started writing unit tests for our Arduino code, and we've created a set of mock objects to help with this. I've managed to convince my boss that we should open source our work, so we've put all of our source on GitHub! You can find it at https://github.com/Mind-Studios/ardutest.
At the moment, the library is more advanced and falls rather heavily on the C++ oriented side of the spectrum. It currently doesn't support very many of the Arduino functions, but we're working on it! The unit tests these have been used in so far are designed to run on a desktop development computer, not the Arduino itself. For speed of development reasons, some of the functionality which was duplicated in avr-libc has not yet been implemented in the mocks, with the preference being linking against the standard libc on the desktop. I'll add that functionality back in when I have a moment for it. We're currently using it with CppUTest, but it should work with any other C++ unit testing framework.
What is supported right now:
- Serial, with input and output buffers which can be manipulated
- A mock EEPROM implementation
- Setting state for both analog and digital pins
- Inspection of pin state for digital pins
- All of the #defines in WProgram.h
- Documentation generation with Doxygen
What's on my immediate TODO list:
- Makefile for a .a object that can be linked in easily
- More support for core Arduino functionality
- Include our header files for making the code platform-independent
Clearly, there is more to be done; I'll add functionality as I have time/need. The entire library is licensed under the LGPL v2.1, and can be used in commercial projects as well as private and open source ones. If you find it useful at all, please let me know; likewise, if you have any contributions to the code, just shoot me an email and I'll see about incorporating them!
Cheers,
Nick Pascucci