Using Selenium for GWT tests.

117 views
Skip to first unread message

siva

unread,
Oct 8, 2008, 9:56:05 AM10/8/08
to Google Web Toolkit
Hi

I'm a novice to GWT and evaluating it for one of the new projects.
Selenium looks interesting as a testing solution but looks more of a
integration test solution. Can we use selenium to unit test our code
and have them run in GWT hosted mode ?

Are there any good tutorials/articles which talk about integrating
Selenium with GWT ?

-Siva

dan

unread,
Oct 9, 2008, 10:36:49 PM10/9/08
to Google Web Toolkit
Hi Siva,

I used Selenium on a project to do integration tests of a GWT
application; it worked pretty well. We didn't run the tests in hosted
mode, we ran the tests in web mode deployed to our application
server. The trick was remembering to use the "waitFor" Selenium
commands to avoid tests intermittently failing due to race conditions
-- this is true for all Ajax applications.

As for testing an application, if you're talking about unit tests,
I've written an article on writing GWT applications test-first that
will appear in the November 2008 issue of Better Software.

This is an excellent blog post on GWT TDD:
http://robvanmaris.jteam.nl/2008/03/09/test-driven-development-for-gwt-ui-code/

I've written a blog post about how and when (and why you shouldn't)
test GWT widgets:
http://blog.danielwellman.com/2008/06/strategies-for-testing-gwt-widgets-and-view-components.html

I think GWT 1.5 also includes a special testing mode designed for
testing with tools like Selenium that allows you to generate
repeatable DOM IDs for widgets.

Hope this information helps,

Cheers,
Dan

siva

unread,
Oct 14, 2008, 3:06:29 AM10/14/08
to Google Web Toolkit
Thanks for the information and references to your blogs, Dan. Really
helps.

If somebody is looking for a way to set ids to GWT widgets
UIObject.ensureDebugId(Element, String) is supported starting GWT 1.5
which greatly helps in integration with Selenium using object
identifiers. The best part is it results in no compiled code in
production environment.

You would also like to to have a look at onEnsureDebugId

-Siva.

On Oct 10, 7:36 am, dan <dwell...@cyrusinnovation.com> wrote:
> Hi Siva,
>
> I used Selenium on a project to do integration tests of a GWT
> application; it worked pretty well. We didn't run the tests in hosted
> mode, we ran the tests in web mode deployed to our application
> server. The trick was remembering to use the "waitFor" Selenium
> commands to avoid tests intermittently failing due to race conditions
> -- this is true for all Ajax applications.
>
> As for testing an application, if you're talking about unit tests,
> I've written an article on writing GWT applications test-first that
> will appear in the November 2008 issue of Better Software.
>
> This is an excellent blog post on GWT TDD:http://robvanmaris.jteam.nl/2008/03/09/test-driven-development-for-gw...
>
> I've written a blog post about how and when (and why you shouldn't)
> test GWT widgets:http://blog.danielwellman.com/2008/06/strategies-for-testing-gwt-widg...

rex

unread,
Nov 3, 2008, 3:05:25 PM11/3/08
to Google Web Toolkit
Hi,

I am new to testing a GWT UI. I am also researching Selenium as said
above. But can anyone tell if Selenium is able to execute database
queries?

Any comment is appreciated.


Thanks,
Rex

On Oct 13, 11:06 pm, siva <siva.sa...@gmail.com> wrote:
> Thanks for the information and references to your blogs, Dan. Really
> helps.
>
> If somebody is looking for a way to set ids toGWTwidgets
> UIObject.ensureDebugId(Element, String) is supported startingGWT1.5
> which greatly helps in integration with Selenium using object
> identifiers. The best part is it results in no compiled code in
> production environment.
>
> You would also like to to have a look at onEnsureDebugId
>
> -Siva.
>
> On Oct 10, 7:36 am, dan <dwell...@cyrusinnovation.com> wrote:
>
> > Hi Siva,
>
> > I used Selenium on a project to do integration tests of aGWT
> > application; it worked pretty well.  We didn't run the tests in hosted
> > mode, we ran the tests in web mode deployed to our application
> > server.  The trick was remembering to use the "waitFor" Selenium
> > commands to avoid tests intermittently failing due to race conditions
> > -- this is true for all Ajax applications.
>
> > As for testing an application, if you're talking about unit tests,
> > I've written an article on writingGWTapplicationstest-first that
> > will appear in the November 2008 issue of Better Software.
>
> > This is an excellent blog post onGWTTDD:http://robvanmaris.jteam.nl/2008/03/09/test-driven-development-for-gw...
>
> > I've written a blog post about how and when (and why you shouldn't)
> >testGWTwidgets:http://blog.danielwellman.com/2008/06/strategies-for-testing-gwt-widg...
>
> > I thinkGWT1.5 also includes a special testing mode designed for
> > testing with tools like Selenium that allows you to generate
> > repeatable DOM IDs for widgets.
>
> > Hope this information helps,
>
> > Cheers,
> > Dan
>
> > On Oct 8, 9:56 am, siva <siva.sa...@gmail.com> wrote:
>
> > > Hi
>
> > > I'm a novice toGWTand evaluating it for one of the new projects.
> > > Selenium looks interesting as a testing solution but looks more of a
> > > integrationtestsolution. Can we use selenium to unittestour code
> > > and have them run inGWThosted mode ?

Arthur Kalmenson

unread,
Nov 13, 2008, 8:38:31 AM11/13/08
to Google-We...@googlegroups.com
Hi Rex, Selenium is a web UI testing framework that you can integrate
with JUnit or TestNG. From there you can do whatever database queries
you want, but Selenium is specifically for testing the UI.

--
Arthur Kalmenson

rex

unread,
Nov 18, 2008, 8:34:21 PM11/18/08
to Google Web Toolkit
Thnx much Arthur. I have started automating tests with Selenium now.
But, do you know of any reporting tools that we can integrate with
selenium for test report generation.


Thnx,
Rex

On Nov 13, 5:38 am, "Arthur Kalmenson" <arthur.k...@gmail.com> wrote:
> Hi Rex, Selenium is a web UI testing framework that you can integrate
> with JUnit or TestNG. From there you can do whatever database queries
> you want, but Selenium is specifically for testing the UI.
>
> --
> Arthur Kalmenson
>

Arthur Kalmenson

unread,
Nov 19, 2008, 8:41:52 AM11/19/08
to Google-We...@googlegroups.com
Sorry, I'm not sure. I haven't started using Selenium yet.

--
Arthur Kalmenson
Reply all
Reply to author
Forward
0 new messages