Runtime custom coverage filter

14 views
Skip to first unread message

Diego Flávia

unread,
May 20, 2024, 3:06:18 PMMay 20
to JaCoCo and EclEmma Users
Hi,

I've started using jacocoagent in a service with some API test suite, but I've got some requirements due to the environment the API test suite runs.

I'm asking here because I couldn't find in the documentation.

1. I need to, somehow, register the coverage filtering by some context custom property, like "user", that is setted when a request is received.

2. Is it possible reset the agent without restarting the service?

Any input will be appreciated! Thank you!

Marc Hoffmann

unread,
May 21, 2024, 1:21:50 AMMay 21
to JaCoCo and EclEmma Users
HI Diego,

1. Can you please elaborate on this a bit more? Do you mean that you want to collect coverage information only for specific users?

2. Yes it is. JaCoCo has an in-process API as well es a remote control option. For the latter die ExecDump.java example and the remote protocol.

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/ef7de037-aca4-45d6-90cd-b7e40baa64a4n%40googlegroups.com.

Diego Flávia

unread,
May 25, 2024, 8:20:34 AMMay 25
to jac...@googlegroups.com
Hi Marc,

1. Yes, that's exactly what I need. The API test suite runs in a shared environment, where other users might be using, so I want to collect coverage information only for the user configured in the API test suite.

2. Nice! I'll take a look.

Thank you.

Regards,
Diego


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/f_EISlxPi3E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/DA9A34F5-445E-4DDC-9B92-860791446411%40mountainminds.com.

Marc Hoffmann

unread,
May 25, 2024, 8:25:36 AMMay 25
to JaCoCo and EclEmma Users
Hi Diego,

JaCoCo records all executions. If multiple users use the API at the same time, there is no chance to collect coverage for a specific user. It requests are serialized, you can add some custom code at the entry point of your service that does the magic (using the JaCoCo runtime API) if the request user matches the specific test user:

  • Reset execution data
  • Execute actual processing
  • Dump execution data

Regards,
-marc


Reply all
Reply to author
Forward
0 new messages