Coberatura works as follows: class files are instrumented/injected
with bytecode that writes out coverage information to a data file as
the code under test is executed by the unit test. Because hosted mode
actually loads the class bytecode into a JVM, it seems to me that the
metrics should still be written without a problem.
I think my question actually boils down to this: Does hosted mode go
back to the source file to create new bytecode when unit test are run?
Does hosted mode use the class files created during compilation for
unit tests?
Thanks,
Ric
The way the GWT works, your Java code is always compiled to JavaScript.
In essence, your GWT test cases end up running as javascript, not java.
Java bytecode never comes into the picture.
Unfortunately, this means that code coverage tools like Cobertura will
not work, as these tools work by instrumenting class files, as you're
rightly mentioned.
The only way I can see this working at the moment is if the GWT team
adds specific support for code coverage tools.
Hope this helps,
Vivek
Is this true? The documentation says:
"By default, [unit] tests run in hosted mode as normal Java bytecode in
a JVM. "
and
"hosted mode, which means that you are interacting with your GWT
application without it having been translated into JavaScript."
Unless I'm completely misreading it, this seems to say pretty clearly
that unit tests are run in hosted mode and hosted mode does not compile
to JavaScript.
Yes, that is my understanding as well. It would be interesting to hear
a reply from the GWT team explaining the problem.