Qt Test-Driven Development using Google Test and Google Mock
In this updated webinar, you will learn the basics of TDD (Test-Driven Development) using a combination of Google Test and the Qt Test Framework, now supported directly by Qt Creator to build and run Qt tests. You will see how Google Mock will allow you to isolate the units of your application for maximum testing using design techniques such as layered design and dependency inversion. Google Test and Google Mock make it easy to write test harnesses that leverage that isolation.
Unit testing is not to be confused with V&V (Verification and Validation) Testing that needs to happen near the end of the project. That is they type of testing that uses Squish. Unit testing will give you confidence that going into V&V that the software will be relatively bug free.
Some topics to be covered:
- The biggest advantage to TDD is testing early
- TDD also guarantees that every line of code is tested
- With near 100% line coverage memory leaks, crashes and exception issues are usually caught early
Challenges to TDD
- Making sure your code is testable
- Can you write a test that test just one line of code?
- Can obscure error conditions be simulated?
- Making sure you don’t test the same code over and over
Testing late and the solution
- Testing late (near the end of the project) finds bugs, but you are not sure where they are
- TDD find the errors immediately narrowing the suspect code to the subset of lines you are working on
- Isolating the "units" of your application so they can be tested individually
- Layering and Dependency Injection in a software design can provide isolation