bmuschko / gradle-clover-plugin

Gradle plugin for generating a code coverage report using Clover
Apache License 2.0
74 stars 49 forks source link

how to generate run time code coverage #124

Open nagaraju-sunkara opened 5 years ago

nagaraju-sunkara commented 5 years ago

Provide a gradle task to genearte instrument classes with coverage reports genearted at a regular interval

Alex-Vol-SV commented 5 years ago

Are you looking for Clover coverage generated during regular usage of the instrumented code? What exactly are you talking about? You need to clarify your request. It is very ambiguous and improperly defined.

nagaraju-sunkara commented 5 years ago

Yes. I am looking for instrumented classes to have a run time coverage.

How can i Generate a single clover database

I could able to generate the instrumented class files . When it build the JAR file with instrumented code, application startup fails.

Alex-Vol-SV commented 5 years ago

When building instrumented code your application must include clover.jar as well. Instrumented code has references to Clover classes so your application needs the JAR file.

See documentation of plugin here: Properties

nagaraju-sunkara commented 5 years ago

Thanks. I could able to generate instrumented JAR file. but it is missing the clover jar as part of build thus throws exception "No class def found".

Alex-Vol-SV commented 5 years ago

You are responsible for adding this JAR to your application when testing with instrumented JAR file. That is expected of you. I am not going to embed Clover JAR contents in your application JAR file. You can do that if you wanted without changes to the plugin if you think it would help. But the normal way of using the instrumented JAR file is by adding the clover.jar in the application, either on the classpath or inside a WAR file if you are deploying in a container.

nagaraju-sunkara commented 5 years ago

i could able to add jar at runtime during build now.

Can you give me the steps to have a singleCloverDatabase when it executes the clover tasks?

Alex-Vol-SV commented 5 years ago

This feature is not implemented yet. We do not handle a clover database produced during an external invocation of instrumented code. If your instrumented JAR is used by an integration test harness managed by Gradle it might be possible to do such a merge of the databases.