Hi Kush,

sure JaCoCo can collect execution data for any Java application.

To collect coverage data of a specific “hit” you have to execute the processing 
in isolation. As JaCoCo collects execution data of all executed code, you can 
not run this test while the server serves other requests too.

The steps are as always:

1) Run the server with the JaCoCo agent attached
2) Execute some test (e.g. exercise the endpoints)
3) Shut down the server properly to get the execution data file
4) Create coverage report

Alternatively JaCoCo agent supports a remote control protocol: This allows to 
collect and reset execution data without shutdown. So you can select separate 
coverage data for each request.

> I am planning to build a report UI on top of this to monitor code coverage 
> against APIs.

I think this is perfectly possible with the JaCoCo APIs.


Regards,
-marc

> On 6. May 2024, at 08:28, 'Kush Mishra' via JaCoCo and EclEmma Users 
> <jacoco@googlegroups.com> wrote:
> 
> Hi 
> 
> I am exploring tools capable of capturing the code coverage against the run 
> of an API.
> There would be a Java application and I would hit the endpoints via postman. 
> I am interested in knowing the code coverage of this hit. Is this possible 
> using Jacoco ? Till now what I have explored about it is all related to unit 
> test cases.
> I am planning to build a report UI on top of this to monitor code coverage 
> against APIs.
> 
> Best regards
> Kush
> 
> 
> 
> Disclaimer: This email and its attachments, if any, is intended for the 
> recipient(s) specified in the email only and may have proprietary, privileged 
> and classified information. If you are not the intended recipient, do not 
> distribute, disseminate or copy this email. Please inform the sender 
> immediately, and delete this email.
> 
> -- 
> 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+unsubscr...@googlegroups.com 
> <mailto:jacoco+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/ee40671e-98f2-4369-808d-d761c5f924b1n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/ee40671e-98f2-4369-808d-d761c5f924b1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/1111D37E-2D03-4D74-9D7D-06C5BA3DA436%40mountainminds.com.

Reply via email to