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

How can I get functional test code coverage reports for mapreduce program.

I want to generate functional test coverage reprots for map reduce program.

first I generate the instrumented artifacts along with the clover.db file

  • Setup Clover configuration in the main pom file
          <plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<includesTestSourceRoots>false</includesTestSourceRoots>
<generateXml>true</generateXml>
<generateHtml>true</generateHtml>
<licenseLocation>/Users/renhy/clover/clover.license</licenseLocation>
<statementContexts>
<log>^(logger|log|LOG|LOGGER)\..*</log>
<logcheck>^if *\((logger|log|LOG|LOGGER)\.is.*</logcheck>
</statementContexts>
<contextFilters>log,logcheck</contextFilters>
</configuration>
</plugin>
then,
  • Run the following command to do instrument, generate instrumented jars and create a clover registry file clover.db
mvn clean clover2:setup install -Dmaven.test.skip=true -Dmaven.clover.singleCloverDatabase=false
After that, I run the functional test and hope that the code coverage information can be writen to the clover.db.
But, because the program is mapreduce program, it is not run locally.

What I should do to make the mapreduce job write code coverage informaton to the clover.db when it runs.

4 answers

0 votes

Hi Jin,

You're using quite old version of Clover-for-Maven - 2.5.1 - I recommend upgrading to the latest version which is 3.1.5.

Have you seen a tutorial on CLOVER/Working+with+Distributed+Applications page?

Regards
Marek

Thanks Marek.

I saw the tutorial page, but it seems not help.

The program is mapreduce program. When it runs, it run on task tracker nodes.

We tried to let the program write coverage info to the tmp cache db file on task tracker nodes, but when the job finished, the tmp cache file is cleaned, we can not get the coverage info.

So far, I think if the clover instrumented program can read and write db file on HDFS, it can solve the problem.

Thanks,

Jin

0 votes

Yes, you can use a shared network drive so that all tracker nodes will write to the same location. You can either:

1) specify clover.db path during source code instrumentation in your pom.xml by defining a following property for clover2:instrument or clover2:setup goal:

<cloverDatabase>/full/path/to/hdfs/location/clover.db</cloverDatabase>

2) or override this value in runtime by a java property:

-Dclover.initstring=/full/path/to/hdfs/location/clover.db

Please note that in case when your application consists of multiple Maven modules, you should compile sources with the single Clover dabatase option (unless you want to deal with multiple databases in multiple locations and merge them after testing):

<singleCloverDatabase>true</singleCloverDatabase>

Regards
Marek

0 votes

Update: I've read more details about HDFS in the documentation and it's rather unlikely that Clover will work on it without modifications - I expected that HDFS works transparently like NFS, but it looks that it's a completely different architecture and API. Sorry for a confusion.

Clover has no API for handling HDFS. However, I have raised a feature request for this, feel free to vote on it:

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...

173 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