Need a tool to find out client side coverage .

225 views
Skip to first unread message

Abhijit Rai

unread,
May 12, 2011, 7:26:11 AM5/12/11
to Google Web Toolkit
Hi all,

Had a query regarding code coverage for the client packages of GWT,
would really appreciate anyone could help out.

I have a client heavy application ( J2EE , GWT ) having 500K lines
client code. We want to automate our test cases and we need to test
the code coverage for these 500K lines too. We are using Selenium,
TestNG (tests) and EMMA for coverage.

On the client side all (most) widgets are internal to the method (say
onModuleLoad() ) and not instance variables.
I have no handle on any of these widgets.

My question is :

Is there a tool that tells us what client end lines got executed when
we execute the corresponding Javascript (generated by GWT) ?




Thomas Broyer

unread,
Jul 2, 2012, 11:10:56 AM7/2/12
to google-we...@googlegroups.com


On Monday, July 2, 2012 3:06:49 PM UTC+2, Guru wrote:
I too have the same requirement as mentioned in this post. I am able to generate the server side coverage report after instrumenting the classes and running the automated tests.
Any pointers on how to get the same report for client side code ? 

I suppose you can use EMMA when running in DevMode: https://developers.google.com/web-toolkit/doc/latest/DevGuideTestingCoverage
(it at least works for GWTTestCases)

There's also some ongoing work to (IIUC) add coverage in prod mode: https://groups.google.com/d/topic/google-web-toolkit-contributors/98YysnK4hWA/discussion

Joseph Lust

unread,
Jul 3, 2012, 12:05:41 AM7/3/12
to google-we...@googlegroups.com
Have you had luck using the patched Emma version with the more recent releases of Emma? They no longer work for me in Indigo. Perhaps I've done it wrong?

I opened it as a ticket to have the GWT patch merged with the Emma trunk, but they responded with won't fix. I looked at the Google patch, but it does not seem relevant to the current codebase. I was hoping the Google folks could update this. Thanks.

Sincerely,
Joseph

Thomas Broyer

unread,
Jul 3, 2012, 5:06:45 AM7/3/12
to google-we...@googlegroups.com

On Tuesday, July 3, 2012 6:05:41 AM UTC+2, Joseph Lust wrote:
Have you had luck using the patched Emma version with the more recent releases of Emma? They no longer work for me in Indigo. Perhaps I've done it wrong?

I opened it as a ticket to have the GWT patch merged with the Emma trunk, but they responded with won't fix. I looked at the Google patch, but it does not seem relevant to the current codebase. I was hoping the Google folks could update this.

Apparently, the patch was about merging coverage data for a class across different classloaders. JaCoCo seems to have no problem with it: http://www.eclemma.org/jacoco/trunk/doc/implementation.html ("java class identity" section).
Now, GWT has some specific knowledge of EMMA (in CompilingClassLoader) so it'd have to be updated for JaCoCo.

BTW, the GWT build scripts run tests with EMMA, so it indeed is still possible to use the provided patched JAR. You just can't use it in Eclipse, so you won't benefit of the integration with the editor.

(disclaimer: I must say I have nearly 0 GWTTestCases, so I don't try to get coverage data on them; for now we've simply excluded our view classes and specific widgets from coverage reports)

Joseph Lust

unread,
Sep 25, 2012, 2:03:40 PM9/25/12
to google-we...@googlegroups.com
There is now a newer patched version for download.


Followed the instructions and it worked well for me. Would still be nice to have it work out of the box, but I don't expect the Emma team to drop everything for GWT. Ideally someone would submit the patch on the Emma and get it in the trunk.


Sincerely,
Joseph

Chris Lercher

unread,
Sep 26, 2012, 7:22:54 AM9/26/12
to google-we...@googlegroups.com
Thanks for the link, Joseph - it's an old version of eclemma, but it works: It shows client side coverage when running in dev mode (not in production mode).

Then again, I'm not sure what the patch does exactly. I installed the unpatched v1.3.2 and v1.5.3 from http://sourceforge.net/projects/eclemma/files/01_EclEmma_Releases/, and they both seem to work without patching: At least they show client side coverage (but I only tested it with a small example, so maybe I'm missing something?)

v2.1 doesn't show client side coverage, even if patched.

Joseph Lust

unread,
Sep 26, 2012, 9:14:51 AM9/26/12
to google-we...@googlegroups.com
Chris,

Indeed, it is old. It still works however, and GWT Coverage is more important to me than moving to v2.1. When getting my whole team to use it, this is easier than asking folks to explode/repackage the jars as the official GWT fix requires. I've looked at the patch on the Google site, but the code it patches/namespaces are now totally different. On asking the Emma team to merge the old fix, hoping they'd have the expertise, they responded with "wont-fix". So, if anyone is bored, and familiar with Jacoco, I'll trade you a beer for a patch. :)


Sincerely,
Joseph

Colin Alworth

unread,
Sep 27, 2012, 9:00:21 PM9/27/12
to google-we...@googlegroups.com
For what it is worth, Maven 2.2.1 with the stock Emma plugin (version 1.0-alpha-3) works just fine with gwt-maven-plugin:test. There are certainly issues with Maven 3, but as we run test coverage outside of our normal nightly builds, we drop to Maven 2 for coverage details.

With the gwt:test goal bound to the test phase, we just run `mvn emma:emma` and get a nice html report (as well as the .ec and .em files). I've been using this strategy since at least GWT 2.2, and it works up to and including GWT 2.5.0-rc1.

-Colin

Thomas Broyer

unread,
Oct 12, 2012, 2:31:00 PM10/12/12
to google-we...@googlegroups.com


On Wednesday, September 26, 2012 3:14:51 PM UTC+2, Joseph Lust wrote:
Chris,

Indeed, it is old. It still works however, and GWT Coverage is more important to me than moving to v2.1. When getting my whole team to use it, this is easier than asking folks to explode/repackage the jars as the official GWT fix requires. I've looked at the patch on the Google site, but the code it patches/namespaces are now totally different. On asking the Emma team to merge the old fix, hoping they'd have the expertise, they responded with "wont-fix". So, if anyone is bored, and familiar with Jacoco, I'll trade you a beer for a patch. :)

No idea how it works, etc. though 
Reply all
Reply to author
Forward
0 new messages