When you’ve got more than the simplest embedded program for Arduino (or any other framework), it becomes much harder to test that it’s working properly by purely running it. For something like Blink, testing is simple because all we need to do is upload it and see the LED turn on and off; there’s little risk of missing anything significant. However, let’s skip forward to a menu based application with Serial or Ethernet control, there is very little chance that you’d catch all the edge cases by manual testing.
Sometimes the situation arises where a product is built (or gets close to being built), before any concerns about it’s stability are discussed or proper planning arranged. Often this leads to code being written without any proper test plan in place. Combined with very tight deadlines there’s often even no plan to go back and fix things up. Once this situation occurs, it’s probable that the product release will be compromised.
This article discusses how to unit test a simple project with Arduino, if you’re not used to writing unit tests, or need more background, then first read this guide on unit testing embedded projects. My favoured library for writing unit tests on Arduino platform is AUnit. It is open source, under a commercial friendly MIT license and provides a nice API. It is available from here: AUnit is available through library manager, just install it direct from the IDE.
It has been quite a bit more than a week since the last update, but a lot has happened in that time! First, we released version 2.1.3 of the library, and switched the designer to use the 2.1 plugins by default. That means that we’ve opened up themes for everyone to use. We’ve also made it really easy to rollback too. However, let’s take a look at where we are now, since the move to a single code base for designer.