Automated Testing in Service Oriented Environments
Speaker: Volker Krause
It is commonly understood that regularly run automated tests can improve code quality considerably. While we have seen an increase in unit tests in KDE over the last years, some parts still lack decent test coverage. One reason for this is the complex setup needed for automated tests for service-based components, a problem that will be addressed by this talk.
Automated tests need clearly defined and reproducible start conditions, should be independent of the environment they are run in and should not modify any persistent state. With the increasing shift towards service oriented designs all over KDE as well as in general, it is not straightforward to meet those constraints. Local D-Bus services for example can only exist in a single instance per session, making it difficult to isolate tests from production data of the developer. Remote network services such as groupware servers or web services provide additional challenges, their availability might be unpredictable and resetting them to a defined starting condition is usually not easily possible.
This talk will present various approaches to deal with these problems, all based on real-world examples from the Akonadi and KDE PIM projects. We start with quick recap of QtTest and simple tricks such as modifying environment variables to improve isolation from the environment the test is run in. Next we will have a look at the technique used in the Akonadi test runner to create a dedicated D-Bus session for testing local D-Bus services without interference. Finally, we discuss two approaches for testing components communicating with network services, fake servers and virtual machines.
Volker Krause
Volker started contributing to KDE back in 2002 and quickly got stuck in the KDE PIM code. Having worked on KDE PIM for some time made him join the newly founded Akonadi project in 2006 where he maintains parts of the core components. Working as a Software Engineer at KDAB he is currently in the lucky position to spend part of his work time on contributing to Akonadi and KDE PIM.