Embedded Unit Testing Framework
Abstract
This thesis addresses the challenges with unit testing of embedded software. Embedded software uses peripheral devices that are not available during testing, which results in higher barriers to use unit testing, compared to normal software. But even with these barriers there are no problems with unit testing of embedded software. The study looks at challenges with unit testing of Energy Micros software library, and solutions to the problems with automated testing of embedded software. Use of automated testing will reduce the number of errors when code is refactored. Use of unit testing will also make it possible to take advantage of agile methods like test-driven development. The main goals for the study is to see if CMock is suitable for generation of mock modules and if testing with mock modules can reduce the number of errors in software.Unity is a test harness that supports the needed assertions for testing of embedded software. CMock is able to automatic generate mock modules, but has a few problems with inline functions and custom types, but it is possible to solve these problems. Even with these problems CMock is able to generate mock modules that is working, and supports the testing of embedded software.An experiment was performed to see if testing of embedded software with mock modules could reduce the number of errors. The result was significant and showed that the number of errors was reduced by using mock modules, compared development without testing. Observations were also done during the experiment, which found some problems with use of mock modules during testing. The experiment was done by undergraduate students in computer science.Use of unit test and mock modules as a substitute for hardware during automated testing on a native computer, it is possible to reduce the numbers of errors and refactor code without breaking the existing functionality.