Re: [java code coverage] Jacocoexec file limitations

174 views
Skip to first unread message

Marc Hoffmann

unread,
Dec 7, 2012, 1:06:46 PM12/7/12
to jac...@googlegroups.com
Hi,

there is no size limit for *.exec files. As those files are loaded into
memory e.g. for report generation there is a practical limit, though.
But even for very large projects I have never seen a *.exec file > 1 MB.

> I am currently adding in more tests which I am sure are covering new
> lines of code (I checked this by single stepping with a debugger)
> which are previously uncovered but are not showing up as colored.

Do you perform a full re-build / test / report cycle? Note that the
classes under test must be the exact same class files as used for report
generation.

Best regards,
-marc


On 2012-12-07 17:30, Harry Terzian wrote:
> Hello,
>
> This maybe a silly question but is there a maximum size limit on the
> jacoco.exec file? My current jacoco.exec file is 5 KB in size.
>
> I am currently adding in more tests which I am sure are covering new
> lines of code (I checked this by single stepping with a debugger)
> which are previously uncovered but are not showing up as colored.
>
> Regards,
> Harry Terzian
>
> --

Harry Terzian

unread,
Dec 10, 2012, 12:02:30 PM12/10/12
to jac...@googlegroups.com
Hello, Thanks for your reply,

I did try recompiling the source code to create the binary from scratch. 
However I have not made any changes to the source code. The rest of my source is colored
correctly apart from the contents of two if statements in two separate methods, I cant figure out why.
I can see the print statements in those ifs but no coverage.

I am using a jar file to generate the jacoco.exec file which contains 
the exact copy of the class files (not jar) which I am providing to the report generator.

Regards,
Harry Terzian

Harry Terzian

unread,
Dec 10, 2012, 12:17:30 PM12/10/12
to jac...@googlegroups.com
I notice that when running that particular test, the number of lines of code in the report are significantly less than when running other tests.
i.e. from 12,000 to 7,500

Regards,
Harry Terzian

Harry Terzian

unread,
Dec 10, 2012, 12:28:05 PM12/10/12
to jac...@googlegroups.com
No, thats not it, fixed project setup and got correct lines of code but still the code in the if statement just doesnt want to tell me that it has been executed!

Regards,
Harry Terzian

Marc Hoffmann

unread,
Dec 10, 2012, 12:41:25 PM12/10/12
to jac...@googlegroups.com
Can you please provide a minimal example?

Thx,
-marc
> --

Harry Terzian

unread,
Dec 11, 2012, 8:13:36 AM12/11/12
to jac...@googlegroups.com
Hello,

I tried to narrow the reason why the code is not being colored, and it seems that it is the if statement that is causing this.
If i remove the if statement the statements under it are shown as colored.
Even if I separate the if statement into two parts, one which detects whether the condition of the "if" is true and sets a flag
and the other which acts upon the flag it still ends up as not being coloured (as shown below).

It seems to only be recording the false cases and not accumulating the true cases.

However I am not sure how to reproduce this with a minimal working example.

I simplified the example as follows:
  1. class 1:  
  2. for ( Input input : inputs )
  3.   {
  4. .........
  5. if( !Errors)
  6. input.combine();
  7. .........
  8. }

          
  1. class 2
  2.     private static boolean combine = false;
  3. public void combine( ) {
  4.         if ( myArrayList.size( )> 0 )
  5.         {
  6.             for ( MyElement element : elements ) {
  7.                 if(element.myEnumElement.hasCombine()) {
  8.                     combined = true; <-- this never gets coloured, whereas it should
  9.                 }
  10. }
  11. }


  1.   Enum class
  1. COMBINATION { 
  2.   Attribute.COMBINE
  3. };
  4.     private enum Attribute
  5.     {
  6.         COMBINE
  7. }
  8.  
  9.     public boolean hasCombine( )
  10.     {
  11.         return attributes.contains( Attribute.COMBINE ); <-- this does get executed and would return true and false, in the test case that I have
  12.     }

Harry Terzian

unread,
Dec 11, 2012, 8:39:22 AM12/11/12
to jac...@googlegroups.com
I found what the problem is. Its that when I do run it in debug mode with eclipse, I dont use the same program arguments as I do when I run it with jacoco.

Sorry to disturb, what a silly mistake.

Regards,
Harry Terzian
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages