GUI testing on unix

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

Thanks in advance

···


Simon Strandgaard

Simon Strandgaard wrote:

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

Thanks in advance


Simon Strandgaard
I haven’t used any UI testing tools in conjunction with QtRuby, but here is
a note from the qt-interest@trolltech.com mailing list about the available
ones for Qt.

– Richard

If you are researching automatic test tool options, there are several
other
options (Free and commercial) available, here are the ones we know about:

KD Executor from KDAB:
http://www.klaralvdalens-datakonsult.se/?page=products?=kdexecutor

QtUnit (Open Source project)
http://www.uwyn.com/projects/qtunit/

Squish, by froglogic
http://www.froglogic.com/

Beta / yet unreleased version tools:

LogicaCMG has a beta version of an automatic testing tool that they use on
their projects. The tool is available for CMG projects and you may also
contact LogicaGMG if you are interested. Contact info@trolltech.com for
contact info.
http://www.logicacmg.com/

WinRunner, by Mercury Interactive
http://www.mercuryinteractive.com/
The Qt/WinRunner integration module is currently in Pre-release status,
feel free to contact us at info@trolltech.com if you are interested in
trying out the product, we can forward you the address of the right
contact

···

On Thursday 04 December 2003 11:00, Eivind Throndsen wrote:

person.

http://ruby-gnome2.sourceforge.jp

···

Le Mon, 15 Mar 2004 22:27:30 +0100, Simon Strandgaard a écrit :

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

I browsed this homepage, but could not find any information about testing.
Does ruby-gnome2 supports UI-testing or not? Am I blind?

···

On Tue, 16 Mar 2004 02:06:31 +0100, Frédéric Logier wrote:

Le Mon, 15 Mar 2004 22:27:30 +0100, Simon Strandgaard a écrit :

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

http://ruby-gnome2.sourceforge.jp


Simon Strandgaard

I believe this is a testing module for C++ written in qt, not to
test qt

···

il Tue, 16 Mar 2004 02:50:47 +0000, Richard Dale Richard_Dale@tipitina.demon.co.uk ha scritto::

QtUnit (Open Source project)
http://www.uwyn.com/projects/qtunit/

[snip KD (KDAB), QtUnit, Squish, LogicaCMG, WinRunner]

Is any of these available within Ruby?

Any clues which of these tools that are best for UI-testing?

I should have mentioned that I’m interested in open-source solutions :wink:

···

On Tue, 16 Mar 2004 02:50:47 +0000, Richard Dale wrote:

Simon Strandgaard wrote:

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

I haven’t used any UI testing tools in conjunction with QtRuby, but here is
a note from the qt-interest@trolltech.com mailing list about the available
ones for Qt.
If you are researching automatic test tool options, there are several
other options (Free and commercial) available, here are the ones we know about:

Simon Strandgaard

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

Write tests in Ruby that create your forms and manipulate the controls thru
Tk’s native interface.

http://www.rubygarden.org/ruby?SvgCanvas

This is the most efficient way, except one cannot use event_generate unless
the window displays. To get around this, use bind_info to drill down into
the Proc object bound to an event, and call that directly:

        oval.bind('Button-1') { |event| doc(event) }
        puts oval.bindinfo('Button-1')[0][0].inspect()
        puts oval.bindinfo('Button-1')[0][1].inspect()
        maybeMainloop()

The bindinfo() returns an array of arrays. inspecting inside them reveals:

#<Proc:0x4019c804>
"%# %a %b %c %d %f %h %k %m %o %p %s %t %w %x %y %A %B %D
                                 %E %K %N %R %S %T %W %X %Y"

That tells us one leaf element of the binding info is a Ruby Proc - a handle
to a block - and the next element is a big string representing its 27
arguments. Those match the 27 members of the event object - in the order
that TkComm::initialize() used them.

So, configure the bound block again, so it prints out the value of every
member of the event - using the ordering we researched. Then click on it one
more time:

        assert_equal(oval.class.name(), 'TkcOval')

        oval.bind('Button-1') { |event|
            p event.serial
            p event.above
            p event.num
            p event.count
            p event.detail


p event.type
p event.widget
p event.x_root
p event.y_root
}

puts oval.bindinfo(‘Button-1’)[0][0].inspect()

puts oval.bindinfo(‘Button-1’)[0][1].inspect()

        maybeMainloop(true)

All those p calls (which are secretly puts *.inspect() calls) give us enough
data to format this list of arguments:

58, "??", 1, 0, "??", false, 0, 1, "NotifyNormal", false,
"PlaceOnTop", 8, 114773445, 0, 80, 26, "??", 209, 1, false,
"??", 1, "0x0", "0x0", 4, @canvas, 209, 207

Now replace the p calls inside the event handler with something testable,
and call the Proc from the program, instead of by clicking on the oval:

        assert_equal('TkcOval', oval.class.name())
        iGotClicked = false

        oval.bind('Button-1') { |event|
            iGotClicked = true
            }
        oval.bindinfo('Button-1')[0][0].call(
            58, "??", 1, 0, "??", false, 0, 1,
            "NotifyNormal", false, "PlaceOnTop", 8,
            114773445, 0, 80, 26, "??", 209, 1, false,
            "??", 1, "0x0", "0x0", 4, @canvas, 209, 207
            )
        assert(iGotClicked)
        maybeMainloop()

And that test passes. We can now write Test Fixtures that simulate user
events as close as possible to the real thing, but without going outside Tk,
or taking shortcuts. But most projects can take those shortcuts.

···


Phlip
http://www.xpsd.org/cgi-bin/wiki?TestFirstUserInterfaces

Simon Strandgaard wrote:

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

The k3d project ( http://k3d.sf.net ) contains a way-cool playback system
that lets it run its tutorials in a “ghost mode”, where you start the
tutorial, and it animates your desktop’s mouse clicking here and there on
the GUI. I don’t know if this is a module that could be used for
capture/playback, but at least it will show the correct event journalling
functions, for both 'nix and MS Windows.

···


Phlip
http://www.xpsd.org/cgi-bin/wiki?TestFirstUserInterfaces

Sorry, but i don’t know what UI testing is.

···

Le Tue, 16 Mar 2004 02:12:17 +0100, Simon Strandgaard a écrit :

On Tue, 16 Mar 2004 02:06:31 +0100, Frédéric Logier wrote:

Le Mon, 15 Mar 2004 22:27:30 +0100, Simon Strandgaard a écrit :

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

http://ruby-gnome2.sourceforge.jp

I browsed this homepage, but could not find any information about testing.
Does ruby-gnome2 supports UI-testing or not? Am I blind?

Simon Strandgaard wrote:

Simon Strandgaard wrote:

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

I haven’t used any UI testing tools in conjunction with QtRuby, but here
is a note from the qt-interest@trolltech.com mailing list about the
available ones for Qt.
If you are researching automatic test tool options, there are several
other options (Free and commercial) available, here are the ones we know
about:
[snip KD (KDAB), QtUnit, Squish, LogicaCMG, WinRunner]

Is any of these available within Ruby?
I would be very surprised if any of these have been used with ruby.

Any clues which of these tools that are best for UI-testing?

I should have mentioned that I’m interested in open-source solutions :wink:
What problem are you trying to solve? Is it volume testing? Regression
testing? IMO, you would normally choose the UI toolkit with a high quality
api that was going to give you the most bug free code, above choosing one
which had the best testing environment.

– Richard

···

On Tue, 16 Mar 2004 02:50:47 +0000, Richard Dale wrote:

gabriele renzi wrote:

···

il Tue, 16 Mar 2004 02:50:47 +0000, Richard Dale > Richard_Dale@tipitina.demon.co.uk ha scritto::

QtUnit (Open Source project)
http://www.uwyn.com/projects/qtunit/

I believe this is a testing module for C++ written in qt, not to
test qt
Well, I’ve downloaded the source to see what it does, and I still don’t
understand, as it doesn’t have any documention. But it does look very C++
specific.

– Richard

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

Write tests in Ruby that create your forms and manipulate the controls thru
Tk’s native interface.
[snip]
And that test passes. We can now write Test Fixtures that simulate user
events as close as possible to the real thing, but without going outside Tk,
or taking shortcuts. But most projects can take those shortcuts.

Interesting… something like that should do it :wink:

Where can Ruby/Tk be obtained from?

···

On Tue, 16 Mar 2004 23:20:32 +0000, Phlip wrote:


Simon Strandgaard

[snip]

Does ruby-gnome2 supports UI-testing or not? Am I blind?

Sorry, but i don’t know what UI testing is.

Not the best starting point, but here is some info about it:
http://c2.com/cgi/wiki?GuiUnitTesting

···

On Tue, 16 Mar 2004 02:27:09 +0100, Frédéric Logier wrote:

Le Tue, 16 Mar 2004 02:12:17 +0100, Simon Strandgaard a écrit :


Simon Strandgaard

Simon Strandgaard wrote:

Simon Strandgaard wrote:

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

I haven’t used any UI testing tools in conjunction with QtRuby, but here
is a note from the qt-interest@trolltech.com mailing list about the
available ones for Qt.
If you are researching automatic test tool options, there are several
other options (Free and commercial) available, here are the ones we know
about:
[snip KD (KDAB), QtUnit, Squish, LogicaCMG, WinRunner]

Is any of these available within Ruby?
I would be very surprised if any of these have been used with ruby.

It surprises me that there isn’t any ui-testing supported on unix/ruby.
However for windows there is:
http://raa.ruby-lang.org/list.rhtml?name=win32-guitest

Any clues which of these tools that are best for UI-testing?

I should have mentioned that I’m interested in open-source solutions :wink:
What problem are you trying to solve? Is it volume testing? Regression
testing? IMO, you would normally choose the UI toolkit with a high quality
api that was going to give you the most bug free code, above choosing one
which had the best testing environment.

Just want to play around with UI-testing. I have never tried it before.
So there isn’t any problems to solve yet :wink:
Maybe write a chapter about UI-testing with ruby.

···

On Tue, 16 Mar 2004 16:26:19 +0000, Richard Dale wrote:

On Tue, 16 Mar 2004 02:50:47 +0000, Richard Dale wrote:


Simon Strandgaard

Simon Strandgaard wrote:

Phlip wrote:

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

Write tests in Ruby that create your forms and manipulate the controls
thru
Tk’s native interface.
[snip]
And that test passes. We can now write Test Fixtures that simulate user
events as close as possible to the real thing, but without going outside
Tk,
or taking shortcuts. But most projects can take those shortcuts.

http://www.rubygarden.com/ruby?SvgCanvas

Interesting… something like that should do it :wink:

Where can Ruby/Tk be obtained from?

Oops. My bad. In my zeal to copy and paste a report I already wrote, I
forgot an important point:

Your own toolkit can “do it”.

For example, here’s the exact same pattern, but using Gtk+ and C:

http://gnomesupport.org/wiki/index.php/TestDrivenDevelopment

A RubyGtk version of that would be a straight translation.

You need these abilities:

  • Query Visual State
    Write test statements that query significant things the user
    must see - such as an edit field containing “Ignatz Mouse”.
    Frequently check the real thing to ensure the

  • Simulate a User
    That’s why my last post was so long - RubyTk cannot
    generate an event on command, unless the window displays,
    and we don’t want it to interrupt our typing. Sometimes your
    library will make that easy, and sometimes you will
    just punt and call the function which you know the user
    input would call. But sometimes, like my last post,
    you will research your library and write a ton of
    extra code just to simulate an input event at a level
    that ensures coverage.

  • Treat I/O Like a Spigot
    both of the above techniques rely on temporarily displaying
    a window, under test, to check that the test is working properly.

All Toolkits provide some of those abilities, and all (in theory) let you
write test fixtures that supply the rest. But the point is to write the
tests using the same language and toolkit as the tested code.

Tell what library you use and I’l look at what sample code I have.

···


Phlip
Test First User Interfaces

Some people use dcop to test Qt applications. But that isn’t Ruby.

Before you write that chapter, you may need to write a test tool. That’s
about what i’m doing.
http://www.clabs.org/wtr/

Bret

···

At 01:19 PM 3/16/2004, Simon Strandgaard wrote:

Just want to play around with UI-testing. I have never tried it before.
So there isn’t any problems to solve yet :wink:
Maybe write a chapter about UI-testing with ruby.


Bret Pettichord, Software Tester
Consultant - www.pettichord.com
Author - www.testinglessons.com
Blogger - www.io.com/~wazmo/blog

Homebrew Automation Seminars
March 19, Redmond, Washington
April 30, Austin, Texas
www.pettichord.com/training.html

Simon Strandgaard neoneye@adslhome.dk wrote in message news:pan.2004.03.16.19.11.29.197348@adslhome.dk

···

On Tue, 16 Mar 2004 16:26:19 +0000, Richard Dale wrote:

Simon Strandgaard wrote:

On Tue, 16 Mar 2004 02:50:47 +0000, Richard Dale wrote:

Simon Strandgaard wrote:

I am curious to if there exists any GUI testing packages for unix.
What about fxruby, gnome, qt, fltk ?

I haven’t used any UI testing tools in conjunction with QtRuby, but here
is a note from the qt-interest@trolltech.com mailing list about the
available ones for Qt.
If you are researching automatic test tool options, there are several
other options (Free and commercial) available, here are the ones we know
about:
[snip KD (KDAB), QtUnit, Squish, LogicaCMG, WinRunner]

Is any of these available within Ruby?
I would be very surprised if any of these have been used with ruby.

It surprises me that there isn’t any ui-testing supported on unix/ruby.
However for windows there is:
http://raa.ruby-lang.org/list.rhtml?name=win32-guitest

Any clues which of these tools that are best for UI-testing?

I should have mentioned that I’m interested in open-source solutions :wink:
What problem are you trying to solve? Is it volume testing? Regression
testing? IMO, you would normally choose the UI toolkit with a high quality
api that was going to give you the most bug free code, above choosing one
which had the best testing environment.

Just want to play around with UI-testing. I have never tried it before.
So there isn’t any problems to solve yet :wink:
Maybe write a chapter about UI-testing with ruby.

for testing web applications check out Web Testing With Ruby
http://rubyforge.org/projects/wtr/

This is a project that uses ruby to control Internet Explorer via its
OLE interface. Its only for Windows though

Simon Strandgaard wrote:

Where can Ruby/Tk be obtained from?

Oops. My bad. In my zeal to copy and paste a report I already wrote, I
forgot an important point:

Your own toolkit can “do it”.
[snip talk about testing principles]
Tell what library you use and I’l look at what sample code I have.

I use fxruby :wink:

However I am thinking of writing a chapter about UI-testing, so
if I can find a toolkit which is simpler to make examples for, than fox
and platform independent too, then it would be good.

But fxruby is hard to beat. Though I havn’t tried wx.

···

On Wed, 17 Mar 2004 16:54:28 +0000, Phlip wrote:


Simon Strandgaard

Bret Pettichord wrote:

Just want to play around with UI-testing. I have never tried it before.
So there isn’t any problems to solve yet :wink:
Maybe write a chapter about UI-testing with ruby.

Some people use dcop to test Qt applications. But that isn’t Ruby.
I’ve recently added dcop support to the ‘Korundum’ KDE superset of QtRuby.
So you could add dcop slots to your ruby application, which would make it
easier to hook up to a test environment.

Below is a minimal program defining a dcop slot ‘mySlot’ - it expects a
string and returns a QPoint to the caller. The caller could be a test
driver program in another process.

– Richard

#!/usr/bin/env ruby

require ‘Korundum’

class MyWidget < KDE::PushButton
k_dcop ‘QPoint mySlot(QString)’

    def initialize(parent, name)
            super
    end
    
    def mySlot(greeting)
            puts "greeting: #{greeting}"
            return Qt::Point.new(50, 100)
    end

end

about = KDE::AboutData.new(“dcopslot”, “dcopSlotTest”, “0.1”)
KDE::CmdLineArgs.init(ARGV, about)
a = KDE::Application.new()
hello = MyWidget.new(nil, “mywidget”) { setText “DCOP Slot Test” }
a.mainWidget = hello
hello.caption = a.makeStdCaption(“DCOP Slot Test”)
hello.show()
a.exec()

···

At 01:19 PM 3/16/2004, Simon Strandgaard wrote:

Simon Strandgaard wrote:

I use fxruby :wink:

Here’s how far I got with a quick experiment in that totally proper GUI
Toolkit.

Note I’m not asking how to finish this example. I hardly bothered to
research it. But it illustrates the “maybe mainloop” pattern for RubyFox.

#!/usr/bin/env ruby

require "fox"
include Fox


def assert(q)
    puts "this app broke"  if not q
end


class HelloWorld
    def initialize()
        @application = FXApp.new("Hello", "FoxTest")

        @main = FXMainWindow.new( @application, "Hello",
                                 nil, nil, DECOR_ALL )

        FXButton.new( @main, "&Hello, World!",
                      nil, @application, FXApp::ID_QUIT )

        @application.create()
        @main.show(PLACEMENT_SCREEN)
    end

    attr :main

    def show()
        @application.run()
    end
end

def test_printHelloWorld()
    hello = HelloWorld.new()
    button = hello.main.children[0]
    assert "Hello, World!" == button.getText

#    hello.show()
end


def test_clickButton()

    hello = HelloWorld.new()
    button = hello.main.children[0]
    button.onEnter

# TODO  put assertion here that proves
#       onEnter did the right thing

end

def main()
    test_printHelloWorld()
    test_clickButton()
end

main()

That program is the hello.rbw file from the Pragmatic Programmer’s
Installer’s RubyFox sample folder, converted into a test rig for a
hypothetically brainless class called HelloWorld. But it illustrates
important test topics.

I did not bother to throw in a test-rig, because the only features we need
were assert().

The test works by promising Fox that we are just about to display a window,
but only if Fox works with us and gets ready to display it. Then we throw
the window away.

The first test, test_printHelloWorld(), simulates looking at the window, and
querying its visual state. We expect a button containing that astounding
statement, “Hello, World!”. But because we don’t call hello.show(), the
window does not flash while the test runs.

The second test, test_clickButton(), is incomplete. Firstly, it only calls
the callback that would have called if we had clicked on the button. I don’t
know if the FXButton class has a reliable Click() method here, to get more
abstract.

Secondly, that test aborts the test run, due to the FXApp::ID_QUIT flag.
Just a little research is required to put a mock event handler in place, to
assert true if our test clicked the button, and if it were properly wired.

All GUI Toolkits should support testing themselves directly, in code, as
efficiently as possible. Most contain many of the primitives required. But
not all make how to do this easy, or obvious.

···


Phlip
Test First User Interfaces