Sunday, September 17, 2017

Test Strategies for Modern GWT (i.e. Elemental2 etc)


Has anyone got any good examples of how they are testing GWT code that is interacting with the browser APIs. 

Historically we just ignored that low level code as we either were using pre-existing Widgets that we implicitly trusted and for that limited amount of jsni or browser interaction that we wrote we just hand tested and limited change in that area. We then built abstractions ala MVP and tested the rest of the app (which was typically 95% of the code anyhoo).

Now that we are moving to Elemental2 there are fewer abstractions and it would be nice to test the low level code. In particular small little elements. 

So how do we people do this? Options that we came up with:

* Ignore. build abstractions and use manual testing where required.
* GWTTestCase - although last time we tried it (maybe ~2010) it was nothing like a real browser and rather slow.
* Compile code and tests to javascript and figure out a way to run them in a real browser and scrape the results.
* Compile code to javascript and use webdriver/selenium to interact with browser.
* Ignore for now and wait till J2CL and use js ecosystems solutions.
* Use something like powermock to mock natives etc and run them in jre

Anyone got any examples of this working or can offer any suggestions? In particular I am interested to see examples that use Elemental2 or other jsinterop code.


Peter Donald

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment