Automated Client Testing

735 views
Skip to first unread message

Mike

unread,
Apr 24, 2007, 5:27:16 AM4/24/07
to Google Web Toolkit
What tools are recommended for automated client testing of GWT
applications?

I've looked at WebTest so far, which is based on htmlunit, but I'm not
making much progess.

Setya

unread,
Apr 24, 2007, 5:38:04 AM4/24/07
to Google Web Toolkit
Hi,

I'm evaluating Selenium now, it looks pretty good.

Regards,

Setya

Ian Bambury

unread,
Apr 24, 2007, 5:38:54 AM4/24/07
to Google-We...@googlegroups.com
JUnit is part of Eclipse. Is there something you want to do which it can't?
 
Ian

 
--
Ian
http://roughian.com

Mike

unread,
Apr 24, 2007, 5:53:06 AM4/24/07
to Google Web Toolkit

On Apr 24, 10:38 am, "Ian Bambury" <ianbamb...@gmail.com> wrote:
> JUnit is part of Eclipse. Is there something you want to do which it can't?
>
> Ian

Is it possible use JUnit to test a running client? For example to log-
in, browse to a page and then validate say that a tree expands and
collapses correctly.

Mike

unread,
Apr 24, 2007, 5:54:13 AM4/24/07
to Google Web Toolkit

Thanks. Is it Selenium RC? We want to have an automated set of
acceptance or regression tests run as part of the build process.

Setya

unread,
Apr 24, 2007, 6:14:41 AM4/24/07
to Google Web Toolkit
> Thanks. Is it Selenium RC?

Yes, exactly. Also try Selenium IDE which is an action recorder than
you can playback. Unfortunately it only runs on Firefox (for now).


Regards,

Setya

Mike

unread,
Apr 24, 2007, 10:05:55 AM4/24/07
to Google Web Toolkit

I'm struggling with Selenium. How do you identify elements on a page?
When I try Selenium IDE it records nothing. (This maybe to do with how
our developers are using GWT rather than Selenium... I managed to log
in with Selenium RC but as soon as I get to a real gwt page I cannot
identify the elements on the page. I've tried using firebug in
firefox, but I'm no closer.

How are you getting on?

Mark Volkmann

unread,
Apr 24, 2007, 10:21:51 AM4/24/07
to Google-We...@googlegroups.com

Yes. You can see a similar example here.
http://www.ociweb.com/mark/programming/GWT.html#Testing

George Georgovassilis

unread,
Apr 24, 2007, 2:52:03 PM4/24/07
to Google Web Toolkit
I use selenium extensively with all my GWT apps - and wouldn't want to
live without it. You can use it to cross-platform test your
applications in the two major browsers - the selenium team claims it
works in almost any browser! Unfortunately it quite often records the
wrong things but it follows a pattern which you can work around.
Things that can go wrong and their remedies:

* It records the wrong element. I find it sometimes recording xpaths
on computed attributes which you can't forsee with a reasonable
investment of time. In this case I assign my own IDs
(DOM.setAttribute(element,"myId")) to elements and use the respective
locators (that's selenium jargon for an expression be it xpath,
javascript etc which returns a DOM element). If you decide to go that
way, do yourself a favor and try to design your widgets in a way that
this ID assignment is done more or less automatically
(inheritance?)... you don't want to see it in your code all the time.

* It doesn't record clicks on images. You have to add a user extension
to the selenium recorder - don't worry, it's javascript, it's easy and
it is somewhere on their site.

* It can't find the elements it's supposed to click on. That's the A
in Ajax - Selenium wants to click on an element as result of a click
on a link or button that is not there yet. You will make good friends
with waitForText or waitForElement which you will have to append
manually to your scripts where you see it fit. This way you tell
selenium to pause the execution until the page has changed into the
state you want it to. You can set timeouts there after which you
assume that your test has failed.

* It hates frames. You will have to come to peace with the setFrame
function which (I don't remember now) is or is not part of the
standard distro. It works more or less like the 'cd' command on the
command prompt where you descent into child frames or navigate up to
the parent frame of the current frame.

* It doesn't do well with closed windows. When you have a listener
that closes a window, you essentially are killing the living space of
Selenium. In this case move the 'close' call to a deferred command.

I'll post more if I can remember anything :)

charlie...@gmail.com

unread,
Apr 24, 2007, 4:46:24 PM4/24/07
to Google Web Toolkit
Is that actually testing anything other than "setText(NAME)" is equal
to "getText(NAME)"? Shouldn't that test set the name to something
else inside of testGreet()? I did not grab the code (or look at it
for more than 5 seconds), so it may be performing the test, or I may
be flat out wrong. Even so, I would recommend the name get something
to something different, then you demonstrate updating that something
different via RPC and checking it. (Beyond that I would not recommend
anyone have an RPC call update a UI element directly - but this is
intended to be a simple example I suppose.)

You can (marginally) test UI level events with GWT, but you really are
only testing whether or not the toolkit itself propagates it's own
internal events (not your own code). You are testing if ClickListener
works, not whether or not your stuff works. And I say marginally
because though there are ways to do it, those ways break down in many
Composite widget situations.

For more testing at the GWT UI level though, see this thread:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/33e8e82fbab3ad31/c42484c086b3a73a.
Also note my take there that you should not really need to do this.
For that level of "integration" testing Selenium is fantastic.
Because Selenium uses the JS engine in the browser, by driving the
browser, you can test across different platforms and so on from the
integration level (the whole app, and this is similar to, but subtly
different than GWT remote testing).

For individual components, widgets, RPC calls, etc, you can *and
should* test using GWTTestCase. The key to that though, is to use a
client side model and controller, along with your View, MVC. This
allows your tests to call the controller and test things. The view
(widget) does not have logic in it that you ever need to fire an event
off of to test. The view widget should just invoke controller methods,
and in some cases listen for model and react to model events
directly. It should not however "do stuff" in terms of manipulating
the model. (Test "controller.doStuff()" instead of inside the widget
having to fire - leave the UI to the widget, and move the logic out to
the model, via the controller).

For more on general testing there are a bunch of threads around such
as:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/c6114b8cb1f38754/c0f0e1879d1285b5
and:

Ian Bambury

unread,
Apr 25, 2007, 10:34:29 AM4/25/07
to Google-We...@googlegroups.com
Yes, you can do that. I haven't used other test tools with GWT projects, so I can't compare the ease with which you can do it, though

On 24/04/07, Mike <ado...@opentext.com> wrote:



--
Ian
http://roughian.com

Boris Lenzinger

unread,
Jun 6, 2007, 4:25:19 AM6/6/07
to Google-We...@googlegroups.com
Hi,

I'm trying to use Selenium to test my application.

I've added identification to some html items, to images, links which
seems to work since I see clicks recorded with correct id.
But now I'm facing the second problem raised in this post: clicks on
image are not recorded. As suggested by George, I went to selenium site
to find out the selenium user extension but saw nothing that can perform
this.
Could you please post the name of this user extension ? or may be I have
to add some code that has been posted somewhere ? then could you post
where to find this ?

Thanks in advance.

Boris

George Georgovassilis a écrit :

--
Boris Lenzinger
-+-+-+-+-+-+-
CSILL (Société en cours de création)
Site Web: http://www.csill.fr

c/o Telecom Paris - ENST
CICA
2229, route des Crêtes
06560 Valbonne Sophia Antipolis
-+-+-+-+-+-+-


George Georgovassilis

unread,
Jun 6, 2007, 4:36:22 AM6/6/07
to Google-We...@googlegroups.com
Hello Boris

If I remember correctly I just followed the instructions [1] in their wiki.

[1] http://wiki.openqa.org/display/SIDE/Contributed+Extensions+and+Formats

eValid

unread,
Jun 22, 2007, 8:12:13 PM6/22/07
to Google Web Toolkit
eValid is a product that may fill some of the gaps noted above.

* eValid has a bi-directional page map to help identify
DOM elements.

* eValid has a special ImageClick command to record
clicks on images.

* eValid handles frame, browser sub-windows, pop-ups
and the like.

* eValid contains a collection of built-in commands
to synchronization (including synchronization of DOM
property values).

You can download your evaluation copy of eValid V7 from:

http://www.e-Valid.com/Products/Download.7/down.evalid.7.phtml?status=FORM

Full details about the eValid web analysis and testing suite
can be found at:

http://www.e-Valid.com

On Apr 24, 2:27 am, Mike <ado...@opentext.com> wrote:
> What tools are recommended forautomatedclienttesting of GWT

Nicky

unread,
Jun 23, 2007, 11:09:24 AM6/23/07
to Google Web Toolkit
We are using WATIR http://www.openqa.org/watir/ from the same site. It
has some level of cross browser support but is primarily for IE
control.
I would say the main advantage is that it uses ruby as a DSL and so
the tests read like a testing script. Also no complex setup required
as Selenium does to have a proxy server to bypass the javascript same
site policy

On Apr 24, 11:52 am, George Georgovassilis

Reply all
Reply to author
Forward
0 new messages