Emma or JaCoCo support needs some attention

254 views
Skip to first unread message

stuckagain

unread,
Apr 7, 2014, 9:09:58 AM4/7/14
to google-web-tool...@googlegroups.com
What is the state for supporting Emma with GWTTestCase ?
 
I see that the documentation still refers to a very old version of Emma (and EclEmma).
How can we use JaCoCo to do automated testing with code coverage with GWT TestCase ?
 
What will happen when moving to Java 8 ? I guess that the old Emma as referred to in the documentation will have a problem with this (does it even support full Java 7 syntax ?)
 
Will GWTTestCase support remain once DevMode goes away ? or do I understand that wrongly ?
 
 
 
 

David

unread,
Apr 11, 2014, 9:44:28 AM4/11/14
to google-web-tool...@googlegroups.com
No feedback from the GWT developers ?


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Goktug Gokdogan

unread,
Apr 11, 2014, 2:08:03 PM4/11/14
to google-web-toolkit-contributors
Emma (which is already broken for some cases) is going to go away with dev mode. We have been talking about js based alternative but I'm not sure when that will be ready.

David

unread,
Apr 11, 2014, 3:11:58 PM4/11/14
to google-web-tool...@googlegroups.com
Any plans to improve unit testing abilities so that we might be able to do more unittesting without using GWTTestCase ?

I've been trying out gwtmockito as an alternative and it is great, but for unit testing widgets it has many limitations.

Sure I am using MVP for the main application logic. But custom widgets are hard to implement and even harder to test the way it currently is.

I think with a little help of GWT changes that maybe it could become easier to inject mocks in the right place instead of using class rewriting and other nasty tricks like gwtmockito is doing.

For many things having some server side fake for GWT.create would already help a lot (for things like CssResources or Messages it is rather easy to just use some dynamic proxy to fake what you normally generate for the client. Maybe some basic working DOM class would be great as wel, because then most widgets could just be created without much problems.

Only the JSNI stuff remains a problem, but maybe if the great ideas of JsInterop and such might make if feasible to even find a solution there ? Or at least putting them in a separate class and using an interface in the widgets to make them mockable for test purposes would be great.

One thing that would make GWT a lot easier to mock for testing purpose is if it would embrace an injection framework like GIN or as done in JBoss Errai. You can basically get rid of all the GWT.create invocations and start using @Inject so that we can replace them with either a generated class or a mocked class.

David

Jens

unread,
May 20, 2014, 7:35:17 AM5/20/14
to google-web-tool...@googlegroups.com
You can actually use JaCoCo with GWT but test coverage is not 100% correct. I do it through Gradle in a small private project. However some lines that a test do hit are not detected by JaCoCo. So reported coverage is less than it should be. Thats probably what the patched emma has corrected.

To make JaCoCo work with GWT you need to start JaCoCo with the classdumpdir parameter which causes JaCoCo to dump all class files into a directory of your choice before GWT's compiling classloader sees and rewrites them.
To generate the coverage report you must then use the classes of the classdumpdir.

That strategy is pretty much the same as in https://github.com/errai/jacoco-gwt-maven-plugin 


-- J.

Nicolas Wetzel

unread,
May 20, 2014, 12:19:11 PM5/20/14
to google-web-tool...@googlegroups.com
HI ! 

did you try gwt-test-utils ? 
it's a very good tool for testing widgets and more without GWTTestCase.


David

unread,
May 20, 2014, 1:12:49 PM5/20/14
to google-web-tool...@googlegroups.com
Hi Nicolas,

No I did not try that one. I tried GWT Mockito which looked promising and I actually managed to test a few widgets until someone added CssResources and other GWT features and then GWTMockito just exploded with a generic error that I should try disabling the classloading cache. 

I am using GIN and I never do a GWT.create directly (GIN does that for you). That helps a lot in testing the higher level classes like Activities. But it does not really help with widgets. (We have some customisations on top of the DataGrid and CellTable and it does not look possible to automate the testing of those.

And using GWTTestCases is really painful especially since we can't even proof that we are doing decent code coverage in our tests. 

David



Jonathan Fuerth

unread,
May 20, 2014, 4:46:06 PM5/20/14
to google-web-tool...@googlegroups.com, Christian Sadilek
Hey David,

Christian Sadilek and I found a working solution to the GWTTestCase vs JaCoCo problem. Of course, it doesn't make GWTTestCase any faster, but it does give you correct coverage reporting for your test cases.

Instructions are here:


Don't let the project's short/old history fool you; this project isn't dead, it's just been working for us and hasn't needed any changes in 2+ years.

Let us know if you run into any problems with it!

-Jonathan


John A. Tamplin

unread,
May 20, 2014, 4:54:45 PM5/20/14
to Google Web Toolkit Contributors
On Tue, May 20, 2014 at 1:12 PM, David <david...@gmail.com> wrote:
No I did not try that one. I tried GWT Mockito which looked promising and I actually managed to test a few widgets until someone added CssResources and other GWT features and then GWTMockito just exploded with a generic error that I should try disabling the classloading cache. 

I am using GIN and I never do a GWT.create directly (GIN does that for you). That helps a lot in testing the higher level classes like Activities. But it does not really help with widgets. (We have some customisations on top of the DataGrid and CellTable and it does not look possible to automate the testing of those.

It isn't clear how much you can do widget tests on the server anyway -- the only way I see it would be useful is widgets that clearly delineate the view from the rest of it, and allow you to test the model/controller.

If you are talking about testing your own code, then likewise you don't test the view on the server.

--
John A. Tamplin

David

unread,
May 21, 2014, 2:37:55 AM5/21/14
to google-web-tool...@googlegroups.com
John,
 
I try to stick to a MVP design as much as possible even for widgets. But in some cases I need to create a GWTTestCase for testing event handling or event widget construction (to see if the right styles or dom structure is created). Unfortunately that is a slow process and it does not help much that I don't see coverage reports for those tests (combined with all the rest of my coverage data).
 
David


--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

David

unread,
May 21, 2014, 2:42:00 AM5/21/14
to google-web-tool...@googlegroups.com
Hi Jonathan,
 
Thanks for the pointer, I will certainly look into this.
 
David


David

unread,
May 21, 2014, 2:57:50 AM5/21/14
to google-web-tool...@googlegroups.com
One question: how do I use this on projects that do not use maven ?
 


On Tue, May 20, 2014 at 10:46 PM, Jonathan Fuerth <fue...@fuerth.ca> wrote:

Nicolas Wetzel

unread,
May 22, 2014, 5:02:41 AM5/22/14
to google-web-tool...@googlegroups.com
Hi David, 

Sorry to be late, 

gwt-test-utils support all of your stuff (CssRessource, Gin, etc) it' build with java assist wich modify widget bycode on the fly to prevents all call to GWT.create 
We use it in my project (very big apps in telecom since 2010). About 1000 integration test (full scenario ) and a lot of  unit test (Presenter) 
It's fast, quick to write et easy to run (junit) .
It's made by a friend of mine : Gael Lazzari 

Hope it helps 

Nicolas 


stuckagain

unread,
May 22, 2014, 11:14:49 AM5/22/14
to google-web-tool...@googlegroups.com
Hi Nicolas,
 
It looks promising, but there is one thing I hate about it: the strict dependency on the GWT version.
 
I think the GWT team should really sit together with Gael to either include this in GWT or to openup  some API's so that we don't need a new build.
 
My fingers are itching to testdrive this, but I'm behind a corporate firewall that stops me from downloading it. I will have to do it at home.
 
David
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

Thomas Broyer

unread,
May 22, 2014, 11:32:06 AM5/22/14
to google-web-tool...@googlegroups.com


On Thursday, May 22, 2014 5:14:49 PM UTC+2, stuckagain wrote:
Hi Nicolas,
 
It looks promising, but there is one thing I hate about it: the strict dependency on the GWT version.
 
I think the GWT team should really sit together with Gael to either include this in GWT or to openup  some API's so that we don't need a new build.

Note: there is a blessed hook to use GWT.create() in the JVM (yes, that means in your server-side code too; the initial goal was to be able to use GWT I18N on the server, John unfortunately no longer works at Google and has very limited time to contribute on this huge task).
Reply all
Reply to author
Forward
0 new messages