In general, RTOS makers treat test automation and continuous integration tools as a separate part of the RTOS. Being such a critical piece of the development cycle, we think that it’s a mistake. mBed OS is an anomaly to that rule. The reason might be that mBed is more than just an RTOS. It’s an overall embedded software suite. Given the breadth of MCUs it supports, you should really give it a serious consideration when choosing the next RTOS you’ll be using.

Of course, I have to point that these tools only work with mBed supported boards and only when you use mBed OS.

Available tools

ARM provides a set of test automation tools with mBed. The most important tools to know are Greentea and mbed-htrun.

Greentea – test automation framework

A test runner that uses mbed-htrun to flash and run tests on devices connected to your machine. Its documentation is a little obscure, so here’s the gist:

You use it with a tool like unity to report the test results over a serial port. But you also need to let it know what’s the execution timeout so it won’t run forever:

// you will need this include

#include “greentea-client/test_env.h”

// you’ll need this code to get called in your main function

GREENTEA_SETUP(40, “default_auto”);

It has great reporting tools that connect nicely with CI tools if you’re able to connect them properly.

The most relevant piece of documentation is this sample – right here. It’s a sample that demonstrates how the firmware should look like. The rest is straightforward.

Mbed-htrun – test automation runner

Htrun does the magic for you – it flashes the desired firmware, resets the device and communicates with the device and reports the results. It’s best to use it through greentea, but you can use it as a standalone right here – https://github.com/ARMmbed/htrun

Where it falls short

These tools are great, but a solid test automation infrastructure should connect to a CI server quickly and easily. In order to connect it to a continuous integration service like Jenkins, Circle CI or Travis, you’ll need to create a server on a computer connected to the device under test. If you’re using Jenkins, you’ll need to setup Jenkins locally on that server too and connected it your main Jenkins server. That’s not that easy. It’s even worse if you’re using a cloud CI. You’ll need to create a web server or using a message queuing service to communicate between the remote CI server and your local server. That is a pain to say the least.

That server will run greentea with the right report parameters – which are perfect for CI. Quite a lot of work, but it’s a must-have for you to generate the real value in test automation.

Summary

Greentea is a great start for ARM. With a bit more work on your end, you’ll be able to benefit from it greatly. Let us know what you think!