Testing client-side behavior of GWT Apps

101 views
Skip to first unread message

Ali Akhtar

unread,
Apr 9, 2016, 1:08:34 PM4/9/16
to GWT Users
What's the preferred way of testing client-side behavior of GWT apps? E.g, say you want to load up the site, click a sign up button, click the submit button, and want to verify that errors are shown. What's the best way to verify that using GWT? 

It seems like this might be a case for regular selanium / webdriver based testing, however, that would require either gwt to be started in SDM before the tests are run, or GWT to be compiled for production & copied to the static resources directory, before tests run. Has anyone done something like this before - if so, can you share you setup please?

Thanks.

Lars

unread,
Apr 10, 2016, 12:48:25 PM4/10/16
to GWT Users
It depends how far you want to go. For sure with selenium/webdriver you could test any web application, but its slow and decoupled from your code. If you are fine to test your frontend code, without the slow event loops, you could do this very fast with gwtmockito. If you need a little bit more you could use gwt-test-utils or GWTTestCase, but keep in mind both base on the old DevMode and will not work with never gwt versions!

salk31

unread,
Apr 14, 2016, 9:31:56 AM4/14/16
to GWT Users
We have gwt unit (htmlunit) based tests and webdriver/firefox based tests. Slowly we are moving more and more towards webdriver/firefox testing.

So much of our client side code is async (server request, refreshes) that is it painful to test in a unit test.

Also webdriver/firefox and some abstraction (such as page object pattern - read good programming/factoring out) means you could swap implementation without changing your tests. Very handy for refactoring/rearchitecting. Not that unlikely in fast move web tech.

When GWT 3.0 is out I'd be interested in looking again at doing very narrow unit tests in a more isolated way.

Cheers

Sam
Reply all
Reply to author
Forward
0 new messages