How can i get simple line information

31 views
Skip to first unread message

Echo

unread,
Dec 4, 2017, 6:40:03 AM12/4/17
to JaCoCo and EclEmma Users
Hi all
I can use CoreTutorial.java to get simple coverage information of a single class. Now i want to get the executed code line of a project. What should i do? 
- I just need the executed code line rather than the HTML report, so i can easily record the code line which was executed. I'll show it below. 


Regards
echo

Evgeny Mandrikov

unread,
Dec 4, 2017, 7:33:19 AM12/4/17
to JaCoCo and EclEmma Users
Mentioned CoreTutorial.java doesn't generate HTML report, but simply shows available data, and works not only for a single class, but for a set of classes, what is essentially "project". So aren't this already shown in it - https://github.com/jacoco/jacoco/blob/e1502d10bfe8eda0a921cc8f34db3fb8f7236c4a/org.jacoco.examples/src/org/jacoco/examples/CoreTutorial.java#L160-L163 ?

Echo

unread,
Dec 4, 2017, 10:42:05 PM12/4/17
to JaCoCo and EclEmma Users
Hi Evgeny
You are right! When i run CoreTutorial.java, i can get simple coverage date. And the available data is what i need. But i only get the TestTarget coverage data, and I need a set of classes coverage data(like the above picture: HelloTest and Hello ). This is the TestTarget https://github.com/jacoco/jacoco/blob/master/org.jacoco.examples/src/org/jacoco/examples/CoreTutorial.java#L37-L55
Regards
Echo

在 2017年12月4日星期一 UTC+8下午8:33:19,Evgeny Mandrikov写道:

Evgeny Mandrikov

unread,
Dec 5, 2017, 3:20:10 AM12/5/17
to JaCoCo and EclEmma Users
Here
https://github.com/jacoco/jacoco/blob/e1502d10bfe8eda0a921cc8f34db3fb8f7236c4a/org.jacoco.examples/src/org/jacoco/examples/CoreTutorial.java#L147
for given ExecutionData Analyzer performs analysis of a single class, but you can supply folders, jars, etc to it - please just explore the used components and read their javadocs:

Note that the way to execute classes to obtain execution data is entirely up to you, e.g. you don't need to use ClassLoader as in CoreTutorial.java (it is just an example), but e.g. can use data that is produced by JaCoCo agent - see https://github.com/jacoco/jacoco/blob/master/org.jacoco.core/src/org/jacoco/core/tools/ExecFileLoader.java
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages