How to perform code coverage at the server side code when the client side APIs are called

1,068 views
Skip to first unread message

abmis...@gmail.com

unread,
Jan 17, 2017, 1:15:33 AM1/17/17
to JaCoCo and EclEmma Users
Hi,

The test suite that we use uses a client-server architecture. We create the proxy of the services and then we call the APIs from the proxy. Upon installing the eclipse plugin and run the coverage test using TestNG, EclEmma displayed the coverage of my test code. I actually want to know how much code was covered at the server side. Could you please tell me the steps to perform the same on the server side?

Would I need to instrument the jars at the server side? The tests that can be invoked from maven are again client side.

Thanks in advance for your help.

-Abhinav

Evgeny Mandrikov

unread,
Jan 18, 2017, 2:35:55 PM1/18/17
to JaCoCo and EclEmma Users, abmis...@gmail.com
Hi,


On Tuesday, January 17, 2017 at 7:15:33 AM UTC+1, abmis...@gmail.com wrote:

Would I need to instrument the jars at the server side?


Yes, to record coverage of classes they should be instrumented, so you should instrument classes on a server side - start your server with JaCoCo Java Agent ( http://www.jacoco.org/jacoco/trunk/doc/agent.html ).

Regards,
Evgeny

abmis...@gmail.com

unread,
Feb 13, 2017, 4:49:11 AM2/13/17
to JaCoCo and EclEmma Users, abmis...@gmail.com
Hi,

Thank you for your reply. I did the same thing, configured my server with JaCoCo agent and started it. Once server was configured, I ran my tests where the clients started calling all the server side code. Upon the termination of server JVM, the data was collected in the data file too. I imported that data file in the eclipse workspace (where the server source code is already there) and I could see the coverage report and can export it in HTML format. Till here, so far so good. It is really simple to use.

Although, I am facing an issue that others users were facing and they resolved it in their pom.xml. The coverage % of some classes is being shown as 0% although they are being called. Please note that I am NOT using maven anywhere. I can see that class in the sessions of the coverage report but it does not have any link. I enabled class dumping and can see the class file over there as well. Could you please help me here?

Evgeny Mandrikov

unread,
Feb 13, 2017, 5:26:59 PM2/13/17
to JaCoCo and EclEmma Users, abmis...@gmail.com
Hi,

Please take a look on entry "Why does a class show as not covered although it has been executed?" in JaCoCo FAQ at http://www.jacoco.org/jacoco/trunk/doc/faq.html
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages