Evaluation of Test-Driven Approaches for Embedded Software Development

Loading...
Thumbnail Image
Journal Title
Journal ISSN
Volume Title
Sähkötekniikan korkeakoulu | Master's thesis
Date
2020-08-17
Department
Major/Subject
Translational Engineering
Mcode
ELEC3023
Degree programme
AEE - Master’s Programme in Automation and Electrical Engineering (TS2013)
Language
en
Pages
58 + 9
Series
Abstract
Software testing is an essential part of software development and one of its goals is to reduce the amount of software bugs. The first stage of software testing, unit testing, is especially important as software bugs are the more expensive to fix the later they are detected. However, unit testing is neglected regrettably often. The usage of unit testing can be promoted by practising test-driven development (TDD), which is more commonly utilised in the traditional software development. Unfortunately, in the development of embedded software it is considered to be difficult to adopt, because embedded software is dependent on the specifics of the hardware it runs on. In order to ease the adoption, a guideline for TDD of embedded software was developed in this thesis. The guideline includes six testing tools and four mocking techniques. The techniques were tested in an embedded case project with one of the presented tools, Google Test. Each of the techniques were deemed to enable a real implementation to be replaced with a test double. The replacement allowed to overcome the challenges related to hardware dependencies and thus, enabled testing on host. The thesis also covers testing on the target hardware by showing how Google Test was able to be modified to run on target and how the required communication was set up between the target hardware and the development machine. In the future, it could be studied whether these testing tools and mocking techniques are sufficient for unit testing embedded software that utilises a real-time operating system.

Ohjelmistotestaus on tärkeä osa ohjelmistokehitystä ja yksi sen tavoitteista on vähentää ohjelmistovirheiden määrää. Ohjelmistotestauksen ensimmäinen vaihe, yksikkötestaus, on erityisen tärkeä, sillä ohjelmistovirheiden korjaaminen on sitä kalliimpaa, mitä myöhemmin ne havaitaan. Yksikkötestaus kuitenkin sivuutetaan valitettavan usein. Sen käyttöä voidaan edistää harjoittamalla tekniikkaa nimeltä testivetoinen kehitys (engl. testdriven development, TDD), jota käytetään yleisimmin tavallisessa ohjelmistokehityksessä. TDD:n käyttöönottoa pidetään kuitenkin vaikeana sulautettujen ohjelmistojen kehityksessä, koska sulautetut ohjelmistot ovat riippuvaisia laitteistosta, jolla ohjelmistoa suoritetaan. Tässä työssä TDD:n käyttöönoton helpottamiseksi kehitettiin ohjenuora, joka koostuu kuudesta testityökalusta ja neljästä riippuvuuksien korvaamistekniikasta (engl. mocking techniques). Tekniikoita testattiin sulatetussa projektissa yhdellä ohjenuoran testityökaluista, Google Testillä. Jokainen tekniikoista todettiin toimivaksi alkuperäisen toteutuksen korvaamisessa testisisijaisella (engl. test double). Tämä poisti laitteistoon liittyvät riippuvuudet ja siten mahdollisti testaamisen kehitysympäristössä. Työ kattaa myös testaamisen kohdelaitteistolla näyttämällä, miten testityökalu saatiin muokattua toimimaan kohdelaitteistolla ja miten vaadittava kommunikointi pystytettiin kehitysympäristön ja laitteiston välille. Tulevaisuudessa olisi hyödyllistä tutkia, voidaanko näitä testityökaluja ja riippuvuuksien korvaamistekniikoita hyödyntää testattaessa sulautettuja ohjelmistoja, jotka käyttävät reaaliaikaista käyttöjärjestelmää.
Description
Supervisor
Vujaklija, Ivan
Thesis advisor
Vaajoensuu, Eero
Keywords
test-driven development, embedded software, embedded systems, unit testing, google test
Other note
Citation