How to unit test GWT+SmartGWT? How to unit test GWT+SmartGWT? selenium selenium

How to unit test GWT+SmartGWT?


We provide Selenium extensions and a user guide for them in the SDK, under the "selenium" directory at top level.

If you download 3.1d (from smartclient.com/builds) there's even more documentation including some samples for JUnit.

Do not use ensureDebugId() (won't have an effect at all). Never try to work with DOM IDs (won't work).

Best practices information in the Selenium user guide explains when you should use setID().


I found that it could be solved by using setID() before the initialization of the widget. But that's the ID of the scLocator and not an HTML ID.

Why don't you try:

widget.ensureDebugId("some-id");

From the Java docs for ensureDebugId():

Ensure that the main Element for this UIObject has an ID property set, which allows it to integrate with third-party libraries and test tools


< defaultUserExtensionsEnabled>true< /defaultUserExtensionsEnabled>
< userExtensions>[path to user-extensions.js]< /userExtensions>

There we go. I managed to make it work. (With the selenium-maven-plugin in the < configuration> tag)

Thanks for your help though.