views:

614

answers:

3

Hello,

Can anybody suggest a good tool to test GWT UI. What is the opinion about using Selenium & Webdriver ? Any pointers and suggestions are welcome.

Thanks, SD

A: 

You can do bog standard unit testing for your GWT components, if you want to do some layout checking things which can't be done through unit tests (can't give you examples since I don't know GWT nearly at all) then you may use Selenium, however Selenium does have some issues in specific cases, namely selecting elements and very rich content which may prove to be hard to handle since GWT is all about rich content.

Esko
+4  A: 

Google themselves have an excellent article describing when and how to apply different testing strategies to GWT apps. The basic idea is to use unit-testing whenever you are testing business logic, but to use Selenium for specific end-to-end tests where you want to simulate user interaction.

ire_and_curses
+2  A: 

The most important thing is limit how much GWT-specific testing you need to do since GWTTestCase and Selenium are so slow. The MVP pattern referenced in the Testing Methodologies helps enormously with this. Always ask yourself "Can I make this view any dumber?" Push logic for dynamically changing the UI into presenters that manipulate views so that you can test the logic in JUnit.

Then I'd suggest doing most of the UI testing in Selenium/Webdriver. Those tests should be fairly simple though: "Does X show up when I click Y?" kinds of things. GWTTestCase ends up being the most useful for me for code that needs to run under Java and GWT.

spankalee
Let me rephrase my comment about GWTTestCase: GWTTestCase is useful for code that needs to run under both GWT and Java, when that code is exposed to GWTs quirks - usually an emulated class or one that depends on an emulated class that behaves in GWT differently than in Java. Standard Java code is fine to test only under regular unit tests, which is the desired goals here.
spankalee