2

I run a unit test, and see how much of the class I'm testing against is covered, and I see its all green (covered). But in my unit test itself, I see red high lights. What does this mean? I don't see any information about the highlights in the tests themselves in the Eclemma documentation.

Godin
  • 9,801
  • 2
  • 39
  • 76
Janac Meena
  • 3,203
  • 35
  • 32

3 Answers3

2

In Eclipse folders containing main code and test code - are source folders. By default EclEmma performs analysis of all source folders and highlight has the same semantic everywhere. If you're not interested in highlighting in certain folders (such as folders containing tests), then you can exclude as described in https://stackoverflow.com/a/40596673/244993

Community
  • 1
  • 1
Godin
  • 9,801
  • 2
  • 39
  • 76
  • Right, but when I'm running the unit test, then all of the lines of the test are being executed...therefore, we should see that all lines in the unit test are highlighted with green. Instead of that, I'm seeing that some tests are highlighted red – Janac Meena Jan 19 '17 at 19:28
  • 1
    @JanacMeena If just some tests highlighted as red, then they are somehow specific. Without Minimal, Complete, and Verifiable example (http://stackoverflow.com/help/mcve) people can only make guesses. Do they test that exception is thrown? Which version of EclEmma do you use? etc. And I doubt that you'll get more than what was already said without providing more context/details, so could you please provide at least screenshot as have been asked before? – Godin Jan 20 '17 at 00:49
1

The Test itself is not tested and so the coverage is zero. You only want to know the coverage of the class under test and not from the test.

Tobias Otto
  • 1,634
  • 13
  • 20
0

In my POM.xml JUnit's scope is test. I removed the scope and the problem is solved.

I don't believe that this is the best possible solution; Eclipse should be able to accept the scope test, but I haven't been able to work out how to do this.

Ben
  • 51,770
  • 36
  • 127
  • 149
kodmanyagha
  • 932
  • 12
  • 20
  • 2
    This post doesn't look like an attempt to answer this question. Every post here is expected to be an explicit attempt to *answer* this question; if you have a critique or need a clarification of the question or another answer, you can [post a comment](//stackoverflow.com/help/privileges/comment) (like this one) directly below it. Please remove this answer and create either a comment or a new question. See: [Ask questions, get answers, no distractions](//stackoverflow.com/tour) – Zoe Aug 24 '19 at 12:32
  • Nope. The majority of this isn't an answer - it's a question. Remove that and you have an answer. Currently, however, the majority of this answer is a question. – Zoe Aug 24 '19 at 12:39