How to run JaCoCo for a sample code ?

58 views
Skip to first unread message

Yogesh Shinde

unread,
Apr 22, 2015, 11:44:06 AM4/22/15
to jac...@googlegroups.com
I have taken all the code into eclipse from "https://github.com/jacoco/eclemma".
But how can I run JaCoCo for a sample code of mine ?

Thanks,
Yogesh

Marc Hoffmann

unread,
Apr 22, 2015, 11:52:46 AM4/22/15
to jac...@googlegroups.com
> https://github.com/jacoco/eclemma

This repository is not JaCoCo, but EclEmma (the Eclipse plug-in for
JaCoCo). If your want to work on the JaCoCo source code the repository
is https://github.com/jacoco/jacoco

> But how can I run JaCoCo for a sample code of mine ?

What exactly do you mean by "run a sample code of mine"?. If you want to
*use* JaCoCo there are pre-built distributions.

Regards,
-marc
> --
> You received this message because you are subscribed to the Google
> Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to jacoco+un...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/d840e3c2-43d9-411f-8012-fe7cb070b905%40googlegroups.com
> [1].
> For more options, visit https://groups.google.com/d/optout [2].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/jacoco/d840e3c2-43d9-411f-8012-fe7cb070b905%40googlegroups.com?utm_medium=email&utm_source=footer
> [2] https://groups.google.com/d/optout

Yogesh Shinde

unread,
Apr 23, 2015, 8:30:25 AM4/23/15
to jac...@googlegroups.com
Problem:
Actually the objective of my thesis project is "Use of mock object in Code Coverage is considered".
1) There is a sample code given (also with test cases given which use mock objects).
2) I have to get and run the source code of code coverage tools (like JaCoCo).
3) This gives 100%(assumption) coverage for sample code which is called by test code using real and mock objects.
4) 100% includes code covered by (real objects) + (mock objects) + (real and mock objects).
5) My interest is into the code covered by (real objects) + (real and mock objects).

6) For this I have to find and modify the "code coverage tool" code.

 Example :
Object A has method a1() which calls object B method b1() and object C method c1().
(i) When I run the tool it gives me 100%(assumption) code coverage.
(ii) When I mock the object C and again run coverage tool it gives 100% coverage.
(iii) When I mock the object C and use real object of C also, tools gives 100% coverage.

But after modifying code in "Code Coverage Tool" it should give me output as 50% for case (ii) above because I don't want coverage for code which is called by ONLY mock object.

My Query:
1) Is the code repository for "Code Coverage Tool" JaCoCo is https://github.com/jacoco/jacoco OR https://github.com/jacoco/eclemma ?
2) Which java file do I need to modify for NOT considering coverage for code called by mock objects ONLY ?

Thanks,
Yogesh

Marc Hoffmann

unread,
Apr 23, 2015, 9:23:12 AM4/23/15
to jac...@googlegroups.com
Hi,

answering your questions:

1) As stated before the repository for JaCoCo ("Java Code Coverage") is
https://github.com/jacoco/jacoco
2) JaCoCo does not consider the calling context when determine code
coverage for a praticular method or class. Probably there is quite a few
"java files" you need to modify to evaluate calling contexts.

Regards,
-marc

On 2015-04-23 14:30, Yogesh Shinde wrote:
> PROBLEM:
> Actually the objective of my thesis project is "Use of mock object in
> Code Coverage is considered".
> 1) There is a sample code given (also with test cases given which use
> mock objects).
> 2) I have to get and run the source code of code coverage tools (like
> JaCoCo).
> 3) This gives 100%(assumption) coverage for sample code which is
> called by test code using real and mock objects.
> 4) 100% includes code covered by (real objects) + (mock objects) +
> (real and mock objects).
> 5) My interest is into the code covered by (real objects) + (real and
> mock objects).
> 6) For this I have to find and modify the _"code coverage tool_" code.
>
> Example : Object A has method a1() which calls object B method b1()
> and object C method c1().
> (i) When I run the tool it gives me 100%(assumption) code coverage.
> (ii) When I mock the object C and again run coverage tool it gives
> 100% coverage.
> (iii) When I mock the object C and use real object of C also, tools
> gives 100% coverage.
>
> But after modifying code in "Code Coverage Tool" it should give me
> output as 50% for case (ii) above because I don't want coverage for
> code which is called by ONLY mock object.
>
> MY QUERY:
> 1) Is the code repository for "CODE COVERAGE TOOL" JaCoCo is
> https://github.com/jacoco/jacoco [6] OR
> https://github.com/jacoco/eclemma [7] ?
> 2) Which java file do I need to modify for NOT considering coverage
> for code called by mock objects ONLY ?
>
> Thanks,
> Yogesh
>
> On Thursday, April 23, 2015 at 1:52:46 AM UTC+10, Marc R. Hoffmann
> wrote:
>
>>> https://github.com/jacoco/eclemma [1]
>>
>> This repository is not JaCoCo, but EclEmma (the Eclipse plug-in for
>> JaCoCo). If your want to work on the JaCoCo source code the
>> repository
>> is https://github.com/jacoco/jacoco [2]
>>
>>> But how can I run JaCoCo for a sample code of mine ?
>>
>> What exactly do you mean by "run a sample code of mine"?. If you
>> want to
>> *use* JaCoCo there are pre-built distributions.
>>
>> Regards,
>> -marc
>>
>> On 2015-04-22 17:44, Yogesh Shinde wrote:
>>> I have taken all the code into eclipse from
>>> "https://github.com/jacoco/eclemma [1]".
>>> But how can I run JaCoCo for a sample code of mine ?
>>>
>>> Thanks,
>>> Yogesh
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>
>>> Groups "JaCoCo and EclEmma Users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to jacoco+un...@googlegroups.com.
>>> To view this discussion on the web visit
>>>
>>
> https://groups.google.com/d/msgid/jacoco/d840e3c2-43d9-411f-8012-fe7cb070b905%40googlegroups.com
>> [3]
>>> [1].
>>> For more options, visit https://groups.google.com/d/optout [4]
>> [5]
>>> [2] https://groups.google.com/d/optout [4]
>
> --
> You received this message because you are subscribed to the Google
> Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to jacoco+un...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/3c13284e-2f64-4846-b2ab-f8312faa7aae%40googlegroups.com
> [8].
> For more options, visit https://groups.google.com/d/optout [4].
>
>
> Links:
> ------
> [1]
> https://www.google.com/url?q75https%3A%2F%2Fgithub.com%2Fjacoco%2Feclemma46sa75D46sntz75146usg75AFQjCNGdoxzGpxuXMQX9XyuYq7jNxa-8dQ
> [2]
> https://www.google.com/url?q75https%3A%2F%2Fgithub.com%2Fjacoco%2Fjacoco46sa75D46sntz75146usg75AFQjCNELIK2B6Mm0hlVaZ7Ickgz-1kWH2Q
> [3]
> https://groups.google.com/d/msgid/jacoco/d840e3c2-43d9-411f-8012-fe7cb070b905%40googlegroups.com
> [4] https://groups.google.com/d/optout
> [5]
> https://groups.google.com/d/msgid/jacoco/d840e3c2-43d9-411f-8012-fe7cb070b905%40googlegroups.com?utm_medium75email46utm_source75footer
> [6] https://github.com/jacoco/jacoco
> [7] https://github.com/jacoco/eclemma
> [8]
> https://groups.google.com/d/msgid/jacoco/3c13284e-2f64-4846-b2ab-f8312faa7aae%40googlegroups.com?utm_medium=email&utm_source=footer

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