Are source files mandatory for clover-report

Hi,

I am getting error when running clover-report, like:

[clover-report] Failed to render syntax highlights for /home/ta230208/TeamCity_Agent_Space/sdvsue800/TeamCity-Agents/ta230208/work/47becb009e2f5761/Commons/src/java/com/teradata/datamovement/model/DDLComparable.java

[clover-report] java.io.FileNotFoundException: /home/ta230208/TeamCity_Agent_Space/sdvsue800/TeamCity-Agents/ta230208/work/47becb009e2f5761/Commons/src/java/com/teradata/datamovement/model/DDLComparable.java (No such file or directory)java.io.FileNotFoundException: /home/ta230208/TeamCity_Agent_Space/sdvsue800/TeamCity-Agents/ta230208/work/47becb009e2f5761/Commons/src/java/com/teradata/datamovement/model/DDLComparable.java (No such file or directory)

[clover-report]         at java.io.FileInputStream.open(Native Method)

[clover-report]         at java.io.FileInputStream.<init>(FileInputStream.java:120)

[clover-report]         at java.io.FileReader.<init>(FileReader.java:55)

[clover-report]         at com.cenqua.clover.registry.FileInfo.getSourceReader(FileInfo.java:442)

[clover-report]         at com.cenqua.clover.reporters.html.source.SourceRenderHelper.getChecksummingReader(SourceRenderHelper.java:413)

[clover-report]         at com.cenqua.clover.reporters.html.source.SourceRenderHelper.render(SourceRenderHelper.java:389)

[clover-report]         at com.cenqua.clover.reporters.html.source.SourceRenderHelper.gatherSrcRenderInfo(SourceRenderHelper.java:154)

[clover-report]         at com.cenqua.clover.reporters.html.source.SourceRenderHelper.insertLineInfosForFile(SourceRenderHelper.java:83)

[clover-report]         at com.cenqua.clover.reporters.html.RenderFileAction.insertLineInfos(RenderFileAction.java:284)

[clover-report]         at com.cenqua.clover.reporters.html.RenderFileAction.render(RenderFileAction.java:131)

[clover-report]         at com.cenqua.clover.reporters.html.RenderFileAction.call(RenderFileAction.java:115)

[clover-report]         at com.cenqua.clover.util.CloverExecutors$LoggingCallable.call(CloverExecutors.java:86)

[clover-report]         at clover.retrotranslator.edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:178)

[clover-report]         at clover.retrotranslator.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)

[clover-report]         at clover.retrotranslator.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)

[clover-report]         at java.lang.Thread.run(Thread.java:662)

[clover-report] /home/ta230208/TeamCity_Agent_Space/sdvsue800/TeamCity-Agents/ta230208/work/47becb009e2f5761/Commons/src/java/com/teradata/datamovement/model/DDLComparable.java (No such file or directory)

I believe this is due instrumented source files not found, right?
My question is whether is it manadatory to have source files when running clover-report? Will my coverage percentage increase if I include source files? Right now getting only 4% for a test but as told by developer it should be above 30%.
My build server is different than test server, still can I give source path? Packages (java) directory structure would be same but the location will be different.
Thanks in advance.
Regards.

3 answers

1 accepted

This widget could not be displayed.

Right now getting only 4% for a test but as told by developer it should be above 30%. My build server is different than test server [...]?

If coverage is lower that expected then it must be something wrong in your environment/build setup. There are many possibilities how to configure Clover for builds on mutiple machines. See:

https://confluence.atlassian.com/display/CLOVER/Using+Clover+in+various+environment+configurations

Questions worth answering:

  • which configuration would fit best to your environment as per the Decision Matrix?
  • do you use relative or absolute initstring for clover database(s)?
  • have you copied clover database(s) from a build server to a test server or are they accessible through a shared network drive?
  • is there a need to use -Dclover.initstring or -Dclover.initstring.basedir property on a test sever (see manual above)?
  • do you have clover.jar deployed on test server (for instance in an application sever's /lib directory; depends on what kinds of tests do you run)?
  • do you see coverage recording files produced on the test server in the directory where clover.db is located?

Actually my product has three components, one can be said as client and other two are servers. They all communicate through a message queue (MQ). Now the issue is I am getting coverage for only client code, I am not able to see any coverage for servers code and that's why my coverage is very low. I have instrumented code for all three components and a coverage.db file.

Can you please let me know how can I get coverage info of those codes as well?

I suggest a following lecture:

* https://confluence.atlassian.com/display/CLOVER/Working+with+Distributed+Applications

Shortly speaking, you have to ensure that:

* Clover database (clover.db) is available from your application server - either use an absolute path for initstring (assuming that build server and test server is the same machine) or provide a -Dclover.inistring JVM option for server's JVM

* Clover runtime JAR (clover.jar) is available in classpath - the easiest way is to put it into <server_dir>/lib directory, so that Clover becomes available for all applications deployed on a server

I suggest checking server's logs whether they contain any Clover-related messages - they shall be present in case of problems mentioned above. You can also run an application server with -Dclover.logging.level=debug to get even more details.

Cheers
Marek

Hi Marek,

That's the problem build server and test server can't be same. :(

Can we give any URL kind of option in clover ant task so that .db can be accessed via other two components?

Thanks again.

You can't use URL. Instead of this, just copy the Clove database from a build server to a test server and point to a new db location on that machine by passing the -Dclover.initstring=/path/to/clover.db JVM option.

This widget could not be displayed.

It's not mandatory to include sources in the HTML report. Lack of sources does not decrease code coverage either.

You can use <clover-report> with srcLevel=false to skip source page rendering:

&lt;clover-report&gt;
  &lt;current outfile="clover_html"&gt;
    &lt;format type="html" srcLevel="false"/&gt;
  &lt;/current&gt;
&lt;/clover-report&gt;

You can also use <clover-report> with <sourcepath> option to point to a different location of sources:

&lt;clover-report&gt;
  &lt;current outfile="clover_html"&gt;
    &lt;format type="html"/&gt;
    &lt;sourcepath&gt;
      &lt;pathelement path="/some/other/location"/&gt;
    &lt;/sourcepath&gt;
  &lt;/current&gt;
&lt;/clover-report&gt;

Yes part of the problem solved, thanks.

This widget could not be displayed.

Marek, just to be clear, the clover.license file must be in all the same places that the clover.jar is. So, if you put clover.jar in your application server's lib directory, a copy of the license file has to go there as well.

Not really ... The clover.license is required for code instrumentation and for report generation. License key is not required to run instrumented application and record coverage files.

Excerpt from https://www.atlassian.com/licensing/clover:

A Clover machine is defined as a single physical computer that Clover is used on to instrument source code or generate coverage reports [...]

See also:

https://answers.atlassian.com/questions/52021/usage-of-10-machine-clover-license-via-25-remote-agents-of-bamboo

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

171 views 18 7
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you