PDA

View Full Version : QTestlib useability question



snydesc
18th October 2012, 17:34
I would like to write some automated tests for an application and would like to use QTestlib but I am confused on how I actually should go about doing it.

From what I read I will have a separate application for each test. What I am confused about is how does the test application know anything about my GUI application? Do I have to instantiate the GUI within the test application and then reference the GUI instance in my test app? This would be unfortunate as every test I run would launch my application.

What if I only want to test a specific dialog that appears in my GUI? I was hoping that I could just launch my GUI application, bring up the dialog and then kick off the test application. However the test application would have no way of accessing the dialog since they are 2 separate executables.

All the examples I see create a widget in the test application and then runs the test off the created widget. It seems like it would be very difficult to use with a multi-dialog application as some of the dialog information may not be accessible as it is private/protected. It seems QTestLib is more geared towards testing individual widgets and not an entire application.

wysota
18th October 2012, 22:20
QTestLib is a way to do unit tests. It's not very useful for testing the whole application. If you want to test a specific dialog, then you write a unit test that creates an instance of the dialog and you call methods of that dialog and see if you get expected results. Testing multiple dialogs with QTestLib doesn't make much sense, as it's not unit testing anymore but rather integration testing or even system testing.