Tuesday, September 19, 2017

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

Excellent - I will look into it. I had always assumed as the modern code did not use GWT.create() anymore that GwtMockito was no longer necessary but I guess it must have other goodies in there ;)

Anyhoo - will dig in. This is one occasion where I do miss the javascript ecosystem with it's ease of testing with a real browser.


On Tue, Sep 19, 2017 at 4:16 PM, Ignacio Baca Moreno-Torres <ignacio@bacamt.com> wrote:
Elemento (so elemental2) uses it to test the builder, but as Erik said, not quite practical for anything else than non-browser-related logic testing.

On Tue, Sep 19, 2017 at 3:48 AM Erik Kuefler <ekuefler@gmail.com> wrote:
If you want to further explore the mock-based option you should check out GwtMockito: https://github.com/google/gwtmockito. It handles natives and finals and has a few other GWT-specific features. I haven't made any big changes to it in the last couple of years, but if there are new things it could do to help with Elemental2 or other modern GWT I'm definitely open to suggestions.

Mocking helps for certain types of logic tests, but for anything that relies on logic that runs in the browser (e.g. calculating the size of elements) it doesn't get you very far, so it's not great for testing widgets. For that I don't think there's much way around WebDrive.


On Sunday, September 17, 2017 at 5:24:10 AM UTC-7, Peter Donald wrote:
Hi,

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.

--
Cheers,

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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,

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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment