Test coverage on reflected code

Hi,

I'm working on a home project that reflects upon an annotated POJO object-graph and does something cool with its structure. Right now my tests all pass. If I turn on code-coverage though, most of them fail. This seems to be because the coverage tools are proxying my classes and therefore reflection is returning different structures to those I expect (that is, I'm not finding POJOs any more).

Is this meant to happen? Can I really not use coverage tools on this code?

Bryan

4 comments
Comment actions Permalink

Hello TCS,

Could you please send me a portion of code which doesn't work with coverage?

BTW what coverage engine do you use?

Thank you
-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Hi,

I'm working on a home project that reflects upon an annotated POJO
object-graph and does something cool with its structure. Right now my
tests all pass. If I turn on code-coverage though, most of them fail.
This seems to be because the coverage tools are proxying my classes
and therefore reflection is returning different structures to those I
expect (that is, I'm not finding POJOs any more).

Is this meant to happen? Can I really not use coverage tools on this
code?

Bryan

---
Original message URL:
http://www.jetbrains.net/devnet/message/5235812#5235812



0
Comment actions Permalink

i have this problem when using Spring JavaConfig.  Presumably due to the cglib enhancements done at runtime?

yuo can reate a 1 bean appcontext and see the code coverage fail.  it only fails with the IDEA runner, EMMA works.  see JavaConfig examples here: http://static.springframework.org/spring-javaconfig/docs/1.0.0.M4/reference/html/ch03.html

0
Comment actions Permalink

Hi Anna,

Can you give me your email address and I'll email the code to you? It's too big to post here (around a dozen classes). This problem occurs with both IDEA and Emma engines, and both in tracking and sampling mode.

Bryan

0
Comment actions Permalink

Hello TCS,

Sure anna.kozlova@jetbrains.com

Thank you
-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Hi Anna,

Can you give me your email address and I'll email the code to you?
It's too big to post here (around a dozen classes). This problem
occurs with both IDEA and Emma engines, and both in tracking and
sampling mode.

Bryan

---
Original message URL:
http://www.jetbrains.net/devnet/message/5236153#5236153



0

Please sign in to leave a comment.