Re: How do I unit test a GUI
Re: How do I unit test a GUI
Quote:
Originally Posted by
jolema
I was tasked with learning how to unit test gui fucntions.
There are different ways of automatically testing UI parts.
One option is to use the built-in functionality of the Qt unit test framework QTest, see key... and mouse... methods here http://doc.qt.io/qt-5/qtest.html
Another option is to first run the UI and record events and then replay those.
Either by doing that yourself, or by using tools designed for that, such as Autopilot-Qt or Squish
Quote:
Originally Posted by
jolema
However, I dont get the overall picture on how to test a function written outside of my test project.
Like for any other unit test, you need to be able to instantiate an object for the class in question.
Either by building the class into the unit test executable (by adding it to the unit test's .pro file) or by linking with a library that contains the class.
When using a UI testing tool such as Squish, that is slightly different as it will launch the application and hook into it for getting and setting values, sending events, etc.
Cheers,
_
Re: How do I unit test a GUI
Quote:
Originally Posted by
anda_skoa
There are different ways of automatically testing UI parts.
One option is to use the built-in functionality of the Qt unit test framework QTest, see key... and mouse... methods here
http://doc.qt.io/qt-5/qtest.html
Another option is to first run the UI and record events and then replay those.
Either by doing that yourself, or by using tools designed for that, such as
Autopilot-Qt or
Squish
Like for any other unit test, you need to be able to instantiate an object for the class in question.
Either by building the class into the unit test executable (by adding it to the unit test's .pro file) or by linking with a library that contains the class.
When using a UI testing tool such as Squish, that is slightly different as it will launch the application and hook into it for getting and setting values, sending events, etc.
Cheers,
_
This clears things up quite a bit. Thank you.