views:

183

answers:

1

Hello.

Qt framework has internal support for testing via QtTest package. Unfortunately, i didn't find any facilities in it that can assist in creating mock objects. Qt signals and slots offers a natural way to create a unit-testing friendly units with input (slots) and output (signals). But is it any easy way to test that calling specified slot in object will result in emitting correct signals with correct arguments? Of course i can manually create a mock objects and connect them to objects being tested, but it's a lot of code. Maybe it's some techniques exists that allows to somehow automate mock objects creation while unit-testing Qt-based applications?

+3  A: 

It seems that you need a QSignalSpy.

chalup
Thanks, seems that's i need. It was a standalone class, not in QtTest, so it's why i missed it :)
Eye of Hell
Actually it is in QtTest library but not in QTest namespace.
VestniK