This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
3 Replies Last post: Feb 21, 2014 7:14 PM by Anna Kozlova  
Jay Gindin Newbie 36 posts since
Jun 17, 2006
Currently Being Moderated

Feb 21, 2014 12:48 AM

How to configure code coverage to ignore lines?

We're using the IntelliJ IDEA code coverage runner. We've got some code within classes where we don't want the code coverage to run. Things like extreme conditions or places where writing a test to cover that very specific case just isn't possible.

 

Is there an annotation or "special comment" (eg., "// START CODE COVERAGE IGNORE", "// END CODE COVERAGE IGNORE") that we can apply?

 

Note that the case isn't where we want to exclude an entire package or class, just parts within classes.

 

Thanks,

 

jay

Anna Kozlova JetBrains 548 posts since
Aug 16, 2004
Currently Being Moderated
Feb 21, 2014 4:57 PM in response to: Jay Gindin
Re: How to configure code coverage to ignore lines?

Hi Jay,

 

not, it's impossible now.

 

IDEA's coverage works over bytecode so comments could be processed only in the editor and this would highly impact the productivity (persentage should be recalculated according to text). With annotations it could be done more efficiently but again - it would have its cost.

 

Do you need 100% coverage?

 

Thanks,

Anna

Anna Kozlova JetBrains 548 posts since
Aug 16, 2004
Currently Being Moderated
Feb 21, 2014 7:14 PM in response to: Jay Gindin
Re: How to configure code coverage to ignore lines?

There is no UI for that.

 

You may run your configuration with -javaagent property copied from "Run with coverage" and pass there additional -exclude parameter (rexeps on classnames)

More Like This

  • Retrieving data ...