Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Clover webapp separate tests on remote system Edited

1. Build the instrumented war file with 

-DflushPolicy=threaded.

2. Deploy to remote server: war file, clover.db, and clover-idea-4.1.2.jar .

3. Add clover.db location to -Dinitstring and

clover-idea-4.1.2.jar to CLASSPATH

4 Restart web app

5. Run tests from regression-test, separate app run from Jenkins

No output files like 

clover.db1uxjcebl6pw7t_1t9_gl3v77_j51erknb.s

What am I missing?

I have looked at the doc pages:

https://confluence.atlassian.com/clover/using-clover-with-maven-+-surefire-test-+-inner-test-classes-285840787.html

https://confluence.atlassian.com/clover/using-clover-for-web-applications-296096967.html

https://confluence.atlassian.com/clover/working-with-distributed-applications-72253463.html

the code runs, but does not report anything.

1 answer

Please check the following:

1. Check if you indeed deployed an instrumented WAR file.

Mistakes do happen :) It is possible that you instrumented the code by Clover, but a WAR packaging task took original class files instead of instrumented ones. Check if you have *.class files named like

<base class name>$__CLR<some_hash>.class

inside the WAR. If they are present - you're good.

 

2. Check if Clover was able to find clover.db at runtime.

A wrong path to clover.db is a very common mistake. Because of the fact that your Jenkins workspace is located on a different machine (and folder) than your web application server, you must ensure that it found the clover.db at runtime. Open your application log / console output and look for Clover error messages. Example:

CLOVER: Unable to load the coverage database at <path>
CLOVER: No coverage data will be gathered.

 

3. Check if Clover did not fail because of other reasons.

Security manager (https://confluence.atlassian.com/clover/working-with-restricted-security-environments-79169080.html):

[CLOVER] FATAL ERROR: Clover could not be initialised because it has insufficient security privileges. 
Please consult the Clover documentation on the security policy file changes required.

The clover.jar not found on the classpath or in incorrect version:

[CLOVER] FATAL ERROR: Clover could not be initialised. Are you " +
"sure you have Clover in the runtime classpath?

[CLOVER] WARNING: The Clover version used in instrumentation does " +
"not match the runtime version. You need to run instrumented classes against the same version of Clover " +
"that you instrumented with.

 

4. Check if you copied all clover.db databases to your target machine or ensure that only one clover.db is created.

This applies mainly to Maven builds. By default Clover produces clover.db file for every Maven module. In such case I'd advise to use singleCloverDatabase parameter or use an absolute path in cloverDatabase parameter (it will cause that all modules will write to the same db). This way you will have to copy just one file to your web server.

 

5. Ensure that Clover's Distirbuted Coverage feature is enabled.

This applies when you want to collect per-test coverage data (I asssume that yes) and that unit tests are launched on your Jenkins server and they call business logic on your running web application server. 

See https://confluence.atlassian.com/clover/using-distributed-per-test-coverage-184025273.html article how to do this.

 

I hope this helps. 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

167 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you