1
votes

I am successful in deploying instrumented WAR(using gradle-clover-plugin) on tomcat and db files are getting created when integration tests execute.

gradle-clover-plugin does not support report generation of code covered by integration tests. Please share if you have achieved it.

Below are the server logs generated when integration tests execute:

[flushed per-test recording (/home/user/workspace/path/to/submodule/build/.clover/clover.db-test1r8dacv75zui7_1v_1di977_jdd8p6lo.s) ] [flushed per-test recording (/home/user/workspace/path/to/submodule/build/.clover/clover.db-test1r8dacv75zui7_1v_8py5lk_jdd8p6lo.s) ]

Writing global coverage file /home/user/workspace/prime-tracking/pilot-tracking/pilot-tracking-engine/build/.clover/clover.db-test8py5lk_jdd7iogiWriting global coverage file /home/user/workspace/path/to/submodule/build/.clover/clover.db-test1di977_jdd7rdyq Writing global coverage file /home/user/workspace/path/to/submodule/build/.clover/clover.db-testumozz6_jdd7iqkq

1
Have you considered using the jacoco agent? This uses on-the-fly instrumentation so you don't need an instrumented war, you can use the same war you use in production - lance-java
@lance-java: I will try jacoco agent. Do you have a link to documentation or example having steps to use it with gradle? - learner
The gretty plugin has out of the box support for starting a servlet container with the correct jacoco jvm args. Or, you could determine a jacoco jvm arg string similar to here and add these jvm args when starting your servlet container - lance-java
Thanks @lance-java for recommending jacoco agent. It works great! - learner

1 Answers

0
votes

I tried to find code coverage with Jacoco. As offline instrumentation is not required for it. I am able to fetch coverage of manual and automated tests with Jacoco. Here are simple to set up jacoco for your project:

http://sdetsforsdets.com/2018/03/19/code-coverage-jacoco/

Integrate jacoco with Sonarqube for detailed analysis.