The Qt framework has internal support for testing through the QtTest package. Unfortunately, I did not find any tools in it that can help in creating mock objects. Qt signals and slots provide a natural way to create unit tests of friendly devices with input (slots) and output (signals). But is there an easy way to verify that calling the specified slot in the object will result in the correct emission of the correct signals? Of course, I can manually create a mock of objects and connect them to the tested objects, but this is a lot of code. Maybe there are some methods that can somehow automate the creation of mock objects when testing based on Qt applications?
unit-testing qt mocking
grigoryvp
source share