kotlinx-kover
kotlinx-kover copied to clipboard
Get code coverage from running process
With jacoco it's possible to use a java agent to get coverage at runtime. This enables collecting coverage during integration and end-to-end tests. I don't see an option like this with kover yet?
More precisely we're building OCI images (using build packs / bootBuildImage) and then run tests against a running container.
Hi, do you mean to get statistics via network ports?
You can instrument the system-under-test with a java agent (not sure how multiplatform support can be achieved). The java agent then provides execution data either over a TCP connection, or by dumping the execution data to the filesystem, which can then be aggregated with data from other sources. (For instance unit test coverage collected in usual way).
@Kantis can you please add some more details/example on how to instrument a JVM? I have an IntelliJ plugin with ui test that includes 2 processes- 1 the ide to test 2 the ui test I would like to collect the coverage for the this scenario
Thanks
@Jonatha1983 you would add
-javaagent:$jacocoJarPath=destfile=$pathWhereYouWantCoverageData/jacoco-it.exec,includes=com.mypackages.*" to the arguments which you start the java process under test with. It all depends a bit on the rest of the infrastructure of your project.
@shanshin feel free to remove this comment if it derails the discussion too much.