Open GoogleCodeExporter opened 9 years ago
Could someone try if you get the same result if you test with the very latest
(unreleased) Javassist?
Original comment by johan.ha...@gmail.com
on 12 Oct 2012 at 10:58
We are using latest unreleased Javassist and can confirm that the coverage
report shows zero code coverage when using powermock tests with Mockito as
reported in the original post.
Original comment by mahnk...@gmail.com
on 16 Oct 2012 at 10:52
I have the same issue:
EclEmma 2.1.4.201208011137
Eclipse 4.2
OpenJDK 7
ArchLinux 3.6.2-1 i686
powermock-api-mockito 1.4.12
Original comment by ccha...@gmail.com
on 16 Oct 2012 at 8:05
Did this occur with a new version of EclEmma or how come it has not been
reported before?
Original comment by johan.ha...@gmail.com
on 17 Oct 2012 at 6:01
In our case we started to use powermock in order to be able to mock static
methods and since then code coverage reports are incorrectly showing zero code
coverage for the class we are testing using powermock.
Original comment by mahnk...@gmail.com
on 17 Oct 2012 at 7:06
Alright. I know cobertura had the same issue before but then it was an issue on
their side this they fixed it a later version. Perhaps you can bring this up to
Emma as well?
Original comment by johan.ha...@gmail.com
on 17 Oct 2012 at 7:13
https://github.com/jacoco/eclemma/issues/15
Original comment by gabor.li...@gmail.com
on 17 Oct 2012 at 7:17
If someone would have time to provide a test and a dummy class attached to this
class, that would be useful for both parties.
Original comment by gabor.li...@gmail.com
on 17 Oct 2012 at 7:18
Please find attached a sample dummy project demonstrating the reported issue.
When running code coverage for unit test
"TestClassUsingMockedStaticMethod.java", it shows zero % coverage in
src/main/java
When running code coverage for unit test "TestClassUsingRealStaticMethod.java",
it shows correct coverage % in src/main/java
Original comment by mahnk...@gmail.com
on 17 Oct 2012 at 9:27
Attachments:
Thanks for the sample classes.
Original comment by gabor.li...@gmail.com
on 17 Oct 2012 at 9:32
This problem began with EclEmma 2.0.0, where they started using Jacoco.
With EclEmma 1.5.3 there is no such problem.
Original comment by zalava...@gmail.com
on 17 Oct 2012 at 8:59
Then I suspect that problem must be fixed in Jacoco or Emma?
Original comment by johan.ha...@gmail.com
on 18 Oct 2012 at 4:41
Yes, maybe. But they won't fix it:
http://sourceforge.net/projects/eclemma/forums/forum/614869/topic/4803215
Original comment by zalava...@gmail.com
on 18 Oct 2012 at 5:46
Ok so there it says that "JaCoCo uses a hashcode of the class definition for
class identity" so that's probably the reason why it won't work. PowerMock
cannot work with modifying classes so I guess there's nothing that can be done
in PowerMock to prevent this.. (correct me if I'm wrong).
Original comment by johan.ha...@gmail.com
on 18 Oct 2012 at 5:52
The root of the problem: "JaCoCo uses a hashcode of the class definition for
class identity."
So the cglib modified classes has different hashcodes than the originals.
I don't think the PowerMock guys can solve this problem, so I think this will
be a long-term problem.
Original comment by zalava...@gmail.com
on 18 Oct 2012 at 5:55
:)
Original comment by zalava...@gmail.com
on 18 Oct 2012 at 5:56
I have just installed ecobertura. Works perfectly together with eclemma inside
one eclipse. It is less handy as eclemma, but it delivers correct coverage. If
you drag this link on eclipse, you can install that easily:
http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=1179
Original comment by gabor.li...@gmail.com
on 18 Oct 2012 at 1:01
Yes, Cobertura is okay but it is not maintained anymore. (It hasn't got any
update since 2011 june, so this is not a long term solution I think)
At the company we using Sonar, it has Cobertura and Jacoco plugins as well, but
the supported way in sonar is also Jacoco for sime time.
Original comment by zalava...@gmail.com
on 19 Nov 2012 at 9:37
Seems to be related to #432.
Original comment by headcrashing
on 22 Feb 2013 at 6:45
There forecasting correction?
Original comment by giovanim...@gmail.com
on 10 Apr 2013 at 2:35
We use EasyMock with PowerMock and got similar issue. The only difference is
that we always got 100% coverage of the under test class, even though there are
lines not covered.
Original comment by eric...@gmail.com
on 14 Apr 2013 at 11:25
I just tried using Clover with Powermock and it works. Not free but at least it
works.
Original comment by hghazo...@gmail.com
on 26 Jun 2013 at 10:21
Facing the same issue. EclEmma giving zero code coverage with powermock based
unit test.
Original comment by dakbhav...@gmail.com
on 25 May 2015 at 1:18
Original issue reported on code.google.com by
linmingr...@gmail.com
on 10 Sep 2012 at 7:55