Measure code coverage on an instaled javo osgi application

47 views
Skip to first unread message

chahid...@gmail.com

unread,
Oct 3, 2014, 5:07:22 AM10/3/14
to jac...@googlegroups.com
Hello,

I'm trying to measure code coverage on an installed application (installed from an EXE), running some sikuli tests (or just doing some actions on the application when i start it).

I'm able to attach jacoco agent using the .ini file of the application, and it generates a jacoco.exec. But when i'm trying to see coverage report using eclipse plugin on the source code of the application, i'm getting just some activators that are covered, and not the manipulations i did...

Otherwise, When i start the application from eclipse using the jacocoagent in the launching options...it did just fine.

Thank you in advance for your help.

Regards,
Issam

Marc R. Hoffmann

unread,
Oct 3, 2014, 7:10:25 AM10/3/14
to jac...@googlegroups.com
Hi Issam,

the problem you probably encounter is documented (http://www.eclemma.org/userdoc/importexport.html):
Warning: Imported execution data must be based on the exact same class files that are also used within the Eclipse IDE. If the external launch was based on different class files (e.g. created with different compiler) no coverage will be shown.
Alternatively you might create the report directy with the class files from your installed application using JaCoCo's build tools (e.g. the report Ant task).

Regards,
-marc 

Issam CHAHID

unread,
Oct 3, 2014, 7:31:24 AM10/3/14
to jac...@googlegroups.com
I know that in my install directory, there's a folder that contain several JARs, that contains compiled classes.
The problem is, I have to launch the application and do some actions (like if Sikuli is doing them), and then see if the coverage reported is good, knowing that i have attached jacocoagent to the application vm, and at the end, the jacoco.exec is generated, but i have to see what is inside... 
The fact is, accordingly to what you said, if I pass the jacoco.exec to eclipse, via eclemma plugin, and make it refer to the sources that i have on eclipse, it will show no coverage, because it will be compiled differently, i can understund that.
But maybe there's a way to read the generated jacoco.exec coverage accordingly to the all JARs containing classes in my install directory?

Thank you very much for your answer Marc, I hope i was able to be clear on what i'm trying to say?

Regards,
Issam

--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/Zg705LNUQ3g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marc R. Hoffmann

unread,
Oct 3, 2014, 8:09:40 AM10/3/14
to jac...@googlegroups.com
EclEmma does not support this directly. As I said you can create an HTML report with JaCoCo. Alternatively you might to try the following in Eclipse:

0) Start with a empty workspace
1) Create a target platform based on your installed product
2) Import the relevant bundles as binaries into the Eclipse workspace
3) Import the exec files

Disclaimer: I never tested this.

Regards,
-marc



On 03.10.14 13:31, Issam CHAHID wrote:

Issam CHAHID

unread,
Oct 3, 2014, 9:40:23 AM10/3/14
to jac...@googlegroups.com
Mr. Hoffman, you'r a boss ! 

Issam CHAHID

unread,
Oct 3, 2014, 11:35:43 AM10/3/14
to jac...@googlegroups.com
Another quick question please,
Is it possible to tell jacoco to use a specific directory to find classes instead of the default "\target\classes"
(I'm trying to use a maven pom to generate jacoco report)

Thank you in advance.
Issam

Marc R. Hoffmann

unread,
Oct 4, 2014, 10:20:00 AM10/4/14
to jac...@googlegroups.com
JaCoCo picks the classes from the project's output directory. You should be able to configure this with:

    <outputDirectory>your/path</outputDirectory>

If the path is the plugins directory JaCoCo should also pick-up JAR files and create reports for them.

Regards,
-marc

Issam CHAHID

unread,
Oct 7, 2014, 11:03:41 AM10/7/14
to jac...@googlegroups.com
Hello Marc,
Sorry for my late answer.
I tried to use the outputDirectory just for jacoco, to make search for a custom path rather than the default target/classes.
It seems impossible, so i used as you said outputdirectory to change it on Maven.

Thank you very much

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