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

Getting custom clover reports with automated builds/tests

Hi,

Here is a brief description of what we are doing and what we are looking for.

We have setup a Jenkins Job to

  • Get sources from HG-repository
  • Instrument the sources with Clover
  • Build the "clovered" war
  • Run JUnit tests on clovered war, gathering the code coverage data
  • Deploy the clovered war to another (Linux-) machine, transferring clover db and traces there as well
  • Run Webtests (using Robot Framework and Selenium) on clovered war, gathering the code coverage data
  • Getting the clover db and traces back to the Jenkins machine
  • Generating Reports on Jenkins machine


Everything is working fine so far, till we want to summarize and aggregate the reports produced by these various tools. What we want to have as output after the job completion would be an automatically generated email with following data:

  • JUnit Tests Total/Failed <-- data comes from surefire plugin responsible for running JUnit tests in Jenkins, but it is also available in Clover reports
  • Webtests Total/Failed <-- data comes from Selenium/Robot Framework, Clover knows nothing about that, right?
  • Total Code Coverage <-- data comes from Clover
  • Branch Code Coverage <-- data comes from Clover


As you see, all the needed data is somehow available and can be displayed in Jenkins. But it is scattered over different locations and is present in different formats. Some reports are even generated on the fly by the corresponding plugins.

The big question now is how to get this data easily to generate a readable high level email. Is there a way to access this data directly without parsing some xml or html sources or other hacks which would be not necessarily accurate, hardly maintainable and not so trivial to implement? Does Clover posts the summary data to some environment variables which can be accessed directly from Jenkins (to put them into the ext-email plugin, for example)?

Any help would be highly appreciated.

Michael

1 answer

0 votes

Regarding Clover part:

You could add the "execute shell" build step with a following command:

java -cp /path/to/clover-X.X.X.jar com.cenqua.clover.reporters.console.ConsoleReporter -i /path/to/clover.db > /path/to/outputfile.txt

This will produce a short summary like one below:

Clover Version 3.1.5, built on April 25 2012 (build-856)
[..]
Coverage Overview -
Coverage:-
Methods: 7/7 (100%)

Statements: 10/10 (100%)

Branches: 0/0 ( - )

Total: 100%

Complexity:-
Avg Method: 1.0
Density: 0.7
Total: 7


Note that clover.license must be present in the same directory where clover-X.X.X.jar is located or passed as a system property, for example:

java -Dclover.license.path=/path/to/clover.license -cp [...]

More details:

Marek

Thanks for your answer.

Is there any chance to customize the output? E.g. adding the Tests Total/Failed numbers?

Yes, I have extended console reporting in Clover 3.1.6. You can use for instance:

  • ConsoleReporter -u -c ALL
  • <clover-log showUnitTests="true" codeType="ALL"/>

in order to see test results. See documentation on confluence pages.

Suggest an answer

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

Investigate deployment-related incidents with Bamboo and Opsgenie together

Back in April of last year one of the major product announcements from Opsgenie was the launch of the Incident investigation view which created a deep connection between Bitbucket and Opsgenie, empow...

90 views 1 3
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