In the previous chapter, we created a drum machine software with some serialization features. In this chapter, we will write the unit tests for this application. Unit testing will help us to verify each part of the source code. We will easily be able to spot an error during software development. To achieve this goal, we will use Qt Test, a dedicated test module for Qt applications.
The example project is a test application using CLI commands to execute and generate a test report. We will cover different types of tests, including datasets, GUI, signals, and benchmarking.
In this chapter, we will cover the following topics:
- Discovering Qt Test
- Executing your tests
- Writing factorized tests with datasets
- Benchmarking your code
- Testing your GUI
- Spying on your application with QSignalSpy