[Gambas-user] Integrate unittest component to Gambas

Adrien Prokopowicz adrien.prokopowicz at gmail.com
Fri May 18 05:34:22 CEST 2018


Le 13/05/2018 à 20:59, Jussi Lahtinen a écrit :
> How to test GUI widgets automatically?
> 
> 
> Jussi

(Whoops, looks like your mail got lost in my inbox, sorry about that!)

It seems both GTK[0] and Qt[1] have some utilities to generate mouse and 
keyboard events to any control/widget you may have, so we could make a 
gb.test.gui component that would wrap those calls and expose them to 
automated tests.

Say you have a myButton that sets a myLabel's text to "Clicked!" when 
clicked, the corresponding test code could look like the following:

Assert.Equals("", myLabel.Text)
myButton.Click()
Wait
Assert.Equals("Clicked!", myLabel.Text)

However, I think the setup for these kinds of tests would be quite a bit 
more complex to come up with, since the tested GUI app would probably 
need a virtual framebuffer to render to.

But of course, testing GUI apps aren't really the focus right now, so it 
will wait a bit. I'll be quite happy already when we hit like 80-90% 
code coverage on the interpreter, compiler and the non-GUI components. :-)

[0] https://developer.gnome.org/gtk3/stable/gtk3-Testing.html
[1] http://doc.qt.io/qt-5/qtest.html

-- 
Adrien Prokopowicz


More information about the User mailing list