Testing GTK application

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing GTK application

Gabor Szabo
Earlier I asked already about the Testing module of GTK, thanks for that reply.

I am looking for something else now.

One of my jobs is to test applications on Windows.
For standard MS based applications Win32::GuiTest works quite well in
being able to
fetch the menu list, select a menu item, move the mouse, click on
buttons by their name,
fill in text fields and even check what's written in them.

Recently I had to solve the same issue with an application written in
C++ using Qt but
so far I had no luck. I'll bring that up on some Qt list later on but
for now I would like
to see if this can be solved for application written in GTK.

The truth is that I have not tried this yet on Windows, so it might
turn out to be straight forward. Windows might expose all the
ineternals of the GTK app. But I doubt it.

So I would like to get you opinion. If I have an application written
in some arbitrary language e.g. C++ using GTK+ how would you test that
application ?

Of course the same question stands on Linux/Unix as well.

Gabor
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Testing GTK application

Gabor Szabo
While I don't see huge enthusiasm about the issue here on the mailing
list let me
continue with what I found.
I ran a GTK application written in Perl and tried to see what WinSpy
http://www.catch22.net/software/winspy.asp
knows about it.

I found a "gdkWindowToplevel" with the real title of the application.
Within that it found many window children and grandchildren and each one of
them was of "gdkWindowChild" type and each one of them had the name of the
program as its title. So it seems I cannot use that.

But then I noticed that WinSpy found itself and it says it is of
"gdkWindowToplevel" type
and it could show all its child windows.

Anyone with some input on the issue ?

Gabor


On 7/30/05, Gábor Szabó <[hidden email]> wrote:

> Earlier I asked already about the Testing module of GTK, thanks for that reply.
>
> I am looking for something else now.
>
> One of my jobs is to test applications on Windows.
> For standard MS based applications Win32::GuiTest works quite well in
> being able to
> fetch the menu list, select a menu item, move the mouse, click on
> buttons by their name,
> fill in text fields and even check what's written in them.
>
> Recently I had to solve the same issue with an application written in
> C++ using Qt but
> so far I had no luck. I'll bring that up on some Qt list later on but
> for now I would like
> to see if this can be solved for application written in GTK.
>
> The truth is that I have not tried this yet on Windows, so it might
> turn out to be straight forward. Windows might expose all the
> ineternals of the GTK app. But I doubt it.
>
> So I would like to get you opinion. If I have an application written
> in some arbitrary language e.g. C++ using GTK+ how would you test that
> application ?
>
> Of course the same question stands on Linux/Unix as well.
>
> Gabor
>


--
Gábor Szabó
Perl in Israel  http://www.pti.co.il
08-975-2897   054-4624648    AIM: gabor529
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Testing GTK application

muppet-6

Gábor Szabó said:
> While I don't see huge enthusiasm about the issue here on the mailing
> list let me continue with what I found.

Don't confuse silence with lack of enthusiasm.  Your question is more about
gtk+ than about perl, and about win32 rather than X11, and so targets a very
small portion of the list members.  And, you asked on a weekend.  Patience.


> I ran a GTK application written in Perl and tried to see what WinSpy
> http://www.catch22.net/software/winspy.asp
> knows about it.
>
> I found a "gdkWindowToplevel" with the real title of the application.
> Within that it found many window children and grandchildren and each one of
> them was of "gdkWindowChild" type and each one of them had the name of the
> program as its title. So it seems I cannot use that.

That's because of the way gtk+ and gdk work together.  Windowed GtkWidgets
create their own GdkWindows for events and display, at the toolkit level.
Most of the GdkWindows are created with

  attributes.window_type = GDK_WINDOW_CHILD;
  attributes.wclass = GDK_INPUT_OUTPUT;

And remember, this is all based on an abstraction of an X11 toolkit.  The port
to win32 maps those attributes to WNDCLASS stuff, but since that's all the
information Gdk has, you don't get detailed names like you get in typical
Win32 apps that use the Win32 API.


The take-home message is that win32 testing tools designed to scrape
information from apps that use the Win32 API and controls probably will not
work very usefully with gtk+ or QT, as those toolkits draw everything
themselves.


But please don't take my word for it.  There have been several people talking
lately about desktop testing projects, and there are at least a few gui
testing systems around.  Check the archives of gtk-devel-list for posts about
testing, and see if what they're talking about is relevant to what you want.


--
muppet <scott at asofyet dot org>

_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Testing GTK application

Gabor Szabo
On 8/1/05, muppet <[hidden email]> wrote:
>
> Gábor Szabó said:
> > While I don't see huge enthusiasm about the issue here on the mailing
> > list let me continue with what I found.
>
> Don't confuse silence with lack of enthusiasm.  Your question is more about
> gtk+ than about perl, and about win32 rather than X11, and so targets a very
> small portion of the list members.  And, you asked on a weekend.  Patience.

yes, you are right I just usually don't have a windows machine and today
I am using one so I quickly tried to test it.

The same question would apply to testing on X11 as well. Maybe not for the
customers but at least for me :-)

> The take-home message is that win32 testing tools designed to scrape
> information from apps that use the Win32 API and controls probably will not
> work very usefully with gtk+ or QT, as those toolkits draw everything
> themselves.

Actually I would like to have a Perl module (similar to Win32::GuiTest)
that could somehow talk to GTK+ or GDK or whoevere has the information
and I could just call PushButton($button_id)

I'll check the gtk-devel-list though right now it is more like general
interest than actual
need. It will become a need next week :-)

Gabor
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Testing GTK application

Scott Lanning
In reply to this post by Gabor Szabo
On Mon, 1 Aug 2005, Gábor Szabó wrote:
> While I don't see huge enthusiasm about the issue here on the mailing
> list let me continue with what I found.  [snip]

I'm very interested in how to test GUI apps!!!!1!!
(intentional '1' instead of '!' to indicate extra enthusiasm :)

> On 7/30/05, Gábor Szabó <[hidden email]> wrote:
>> So I would like to get you opinion. If I have an application written
>> in some arbitrary language e.g. C++ using GTK+ how would you test that
>> application ?
>>
>> Of course the same question stands on Linux/Unix as well.
[snip]
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Testing GTK application

Scott Lanning
In reply to this post by Gabor Szabo
On Mon, 1 Aug 2005, Gábor Szabó wrote:
> Actually I would like to have a Perl module (similar to Win32::GuiTest)
> that could somehow talk to GTK+ or GDK or whoevere has the information
> and I could just call PushButton($button_id)

Exactly!!!!!! (ok, I'll stop :)
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Testing GTK application

Jan Hudec
In reply to this post by Gabor Szabo
On Mon, Aug 01, 2005 at 19:00:40 +0200, Gábor Szabó wrote:
> On 8/1/05, muppet <[hidden email]> wrote:
> The same question would apply to testing on X11 as well. Maybe not for the
> customers but at least for me :-)

Well, I have managed to find two tools on Sourceforge: X11::GUITest and
ltxf. They both say they are beta and I expect neither of them is
capable of finding which window is what, since that's sealed in the
application and the X server simply has no chance to know...

... except of course if Gtk itself exposed it. I don't think it does,
but it might not be hard to add a debugging more to Gtk in which it
would attach a special property stating the type and address object of
the object to which the window belongs.

You would have to make the application tell you what objects it is
creating. Which leads me to another suggestion -- in debugging mode,
connect a handler to realize signal (I hope it's the one creating the
window) of the widgets you need to control, that would print out
"forreign id" of the Gdk windows. Then look up the windows by ids in
X11::GUITest or ltxf.

At first I thought there is no way to get that native id, but then
I recalled all drawables have it. There are actually three(!) methods
that get it: XID, XWINDOW and get_xid. I assume they match to
GDK_DRAWABLE_XID, GDK_WINDOW_XWINDOW and gdk_drawable_get_xid
respectively, which I further assume to be the same thing anyway.

> > The take-home message is that win32 testing tools designed to scrape
> > information from apps that use the Win32 API and controls probably will not
> > work very usefully with gtk+ or QT, as those toolkits draw everything
> > themselves.
>
> Actually I would like to have a Perl module (similar to Win32::GuiTest)
> that could somehow talk to GTK+ or GDK or whoevere has the information
> and I could just call PushButton($button_id)

Hm, that would require the implementing the introspective interface
I talked about above -- having Gtk attach type, name, pointer and such
things to a widget's window as special property, when invoked in
debugging mode. I am not going to implement it though.

> I'll check the gtk-devel-list though right now it is more like general
> interest than actual
> need. It will become a need next week :-)

I fear it's a bit more work than a week to do it properly. You can go
with logging the X ids from the application for now.

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <[hidden email]>

_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Testing GTK application

Gabor Szabo
On 8/4/05, Jan Hudec <[hidden email]> wrote:
> > I'll check the gtk-devel-list though right now it is more like general
> > interest than actual
> > need. It will become a need next week :-)
>
> I fear it's a bit more work than a week to do it properly. You can go
> with logging the X ids from the application for now.

I don't know and I don't have the knowladge in this field but I think
it would be important to realize that this seems to be a major issue
for anyone who would like to do a black-box testing of the application.

Gabor
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Testing GTK application

Jan Hudec
On Thu, Aug 04, 2005 at 20:18:05 +0300, Gábor Szabó wrote:

> On 8/4/05, Jan Hudec <[hidden email]> wrote:
> > > I'll check the gtk-devel-list though right now it is more like general
> > > interest than actual
> > > need. It will become a need next week :-)
> >
> > I fear it's a bit more work than a week to do it properly. You can go
> > with logging the X ids from the application for now.
>
> I don't know and I don't have the knowladge in this field but I think
> it would be important to realize that this seems to be a major issue
> for anyone who would like to do a black-box testing of the application.
I am not currently subscribed to the gtk devel list, so I don't intend
to discuss the advanced solution now.

The simple solution does not require any support though, though it is
custom to the application tested. The idea is, that for each widget in
the application that you need to manipulate from test suite, you add
code like:

$widget->signal_connect_after("realize", \&debug_realize, "widget-name")

and then the hook would be along the lines of:

sub debug_realize {
    my ($widget, $name) = @_;
    print STDERR $name . ':' . $widget->window->get_xid . "\n";
}

Now the test driver would read stderr of the application to find which
windows it should send the events to. You can only do it for widgets
that actually accept events -- things like labels and images don't have
their own windows. The get_xid method is for X. For Windows there should
be some other similar method.

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <[hidden email]>

_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

signature.asc (196 bytes) Download Attachment