Report
4 days, 20 hours ago.

Test best practices for libraries

I've been trying to understand the mbed documentation on testing, and the existing docs unfortunately feel more like reminders to people familiar with the subject than tutorials. I'm a primarily Java developer (familiar with the standard xUnit family) trying to get a handle on the TDD process for mbed libraries in particular.

I am writing a standalone library to control an external I2C device and want to test that it tracks state appropriately, sends the right commands, and so on. This library will be available in the general mbed online IDE. Since this library doesn't have a main of its own, do I simply need to write out my tests using utest following the formula here? Is there some sort of process, similar to mvn test or make test (which are run as intermediate steps when packaging or installing), to make sure that the test suite is run as a normal part of a push, or is that something I have to take care of manually since the C++ libraries are distributed as sources?

I'm also writing a supervisor library that will be a part of my main application, which does have a main. Is there any better solution yet than the awful hack of hiding the main.cpp to prevent the test harness from producing collisions? If not, is there a recommended automated solution for handling this in a CI-type environment?

Comment on this question

1 Answer

1 day, 5 hours ago.

Christopher,

I understand your frustration. We are working on making the docs around testing more user friendly. In the mean time you can find a video introduction to the tools here : https://www.youtube.com/watch?v=7wfZKRa8MCE&list=PLiVCejcvpseshXQPDwD4WROT6dJo-zSbs . Specifically it will show you how to create a green tea project and run tests on it. I believe this will be the most helpful for you.

-Austin


To post an answer, please log in.