| Name | Cobertura plugin |
|---|---|
| Version | 2.0.2 |
| Product Versions | 1.2.x,2.0 |
| Author(s) | Ross Rowe |
| Homepage | http://confluence.atlassian.com/display/CODEGEIST/Cobertura+plugin |
| Price | Free |
| License | BSD |
| JavaDocs | See cobertura_bamboo.zip |
| IssueTracking | http://developer.atlassian.com/jira/browse/CBRT |
| Subversion URL | https://svn.atlassian.com/svn/public/contrib/bamboo/bamboo-cobertura-plugin or browse via fisheye |
| Download JAR | cobertura_bamboo-1.0.5.jar (supports 1.2.x)/cobertura_bamboo-2.0.2.jar (supports 2.x) |
| Download Source | cobertura_bamboo.zip |
Description/Features
A plugin that will parse and record Cobertura coverage reports, and send notifications if the code coverage doesn't reach a specified percentage.
In order to help you identify source code additions that don't include corresponding tests (and subsequently identify the culprits
), the Cobertura plugin will list significant coverage changes (positive and negative) on the results page.
Usage
- Copy the cobertura_bamboo-2.0.2.jar file into your <BAMBOO_HOME>/webapp/WEB-INF/lib directory and restart Bamboo
- In the configuration of your plan, there should be a new Cobertura section on the 'Builder Configuration' tab. Here you can specify whether your plan generates Cobertura reports, and if so, the location of the XML report file.

- That should be it, you should now see a Cobertura tab on your Plan and on any new builds that generate Cobertura report files.

The plugin can also be configured to send notifications if the line rate does not exceed a specified threshold (ie. the build's coverage wasn't good enough!). On the 'Build Notifications' tab of the Configuration page, you can specify whether you'd like Bamboo to send a notification, and the desired line rate threshold.

Jira Issues
Version History
Bamboo 2.x
| Version | Date | Description |
|---|---|---|
| 2.0.2 | 5 June 2008 | Updated plugin to work with Perforce repository layout(CBRT-9) |
Bamboo 1.x
| Version | Date | Description |
|---|---|---|
| 1.0.5 | 3 November 2007 | Updated notification logic to work with Bamboo 1.2.4(CBRT-9) |
| 1.0.4 | 2 November 2007 | Fixed NullPointerException(CBRT-8) |
| 1.0.3 | 20 October 2007 | Ensure that cobertura results files can be parsed without an internet connection (CBRT-7) |
| 1.0.2 | 12 September 2007 | Ensured data contained in multiple files gets aggregated (CBRT-6) |
| 1.0.1 | 17 June 2007 | Updated plugin to support Bamboo 1.2 |
| 1.0.0 | 12 May 2007 | Final version for submission |
| 0.9.5 | 10 May 2007 | Removed some logic that was parsing Cobertura only if build produced test results |
| 0.9.4 | 9 May 2007 | Added some extra logging in the build processor |
| 0.9.3 | 8 May 2007 | Fixed NullPointerException (CBRT-4) |
| 0.9.2 | 7 May 2007 | Included display of significant coverage changes since last build on Build Results page |
| 0.9.1 | 6 May 2007 | Included threshold checking logic |
| 0.9.0 | 25 April 2007 | Initial stable version |

Comments (21)
Apr 25, 2007
Edwin Wong says:
Hi Ross, Thanks for the submission! That's awesome! There are some guys here w...Hi Ross,
Thanks for the submission! That's awesome!
There are some guys here who were looking for this.
Cheers,
Edwin
Apr 25, 2007
Andreas Knecht says:
Hi Ross, Yeah, I love it! I've only been able to get code coverage reports happ...Hi Ross,
Yeah, I love it! I've only been able to get code coverage reports happening with Cobertura in JIRA. (Clover didn't work since there was some interference with the in-memory database it sets up and the one that the JIRA unit tests set up.)
I was looking at developing this myself at our next fedex day. I've deployed it on our internal Bamboo box for JIRA. I'll let you know how it goes!
Cheers,
Andreas
Apr 25, 2007
Ross Rowe says:
No worries, glad that it's useful:) I can't take too much credit for it, as much...No worries, glad that it's useful
I can't take too much credit for it, as much of the code was 'inspired' by the Clover plugin! I'm currently working on a plugin for PMD, and if I have time, I'll try to look at doing something with Nant and Nunit integration.
May 01, 2007
Andreas Knecht says:
Hi Ross, Just thought I'd provide a little bit of feedback from using the plugi...Hi Ross,
Just thought I'd provide a little bit of feedback from using the plugin on JIRA for a couple of days now.
First off: Great job! Configuration was as easy as expected, and everything worked fine first go.
Improvements: The stats/trends I'm currently seeing aren't particularly useful (this is no criticism of your work, but something that should be addressed in the Clover plugin as well). For example, the reports currently tell me that coverage increased by 0.1% in JIRA from the last week to this. Yay!
What would be much more useful is if the plugin would generate a list of classes that have changed since the last run (in a positive or negative way). I'd imagine it shouldn't be too difficult to generate a list of the top ten classes for which coverage increased/decreased the most between builds. I could then look at these classes in the coverage report (which I'm currently attaching to the build as an artefact) and find out what's changed exactly. This would be much more useful than just a global 0.1% increase.
Let me know what you think!
Cheers,
Andreas
May 01, 2007
Ross Rowe says:
Hi Andreas, thanks for the feedback! I totally agree with you about the usefulne...Hi Andreas, thanks for the feedback! I totally agree with you about the usefulness (or lack thereof) of the stats. Your suggestion about the top ten classes with coverage changes is excellent, and shouldn't be too difficult to extrapolate.
One thing I'm working on for both the PMD and Cobertura plugins is specifying a post build action that will send a email/IM (depending on the project settings) if the build's coverage falls below a specified threshold. This will mean that although a build might pass, the team will become aware that the coverage of tests has dropped (which is useful to a testing nut like myself). Do you think that this would be a useful feature?
We've now got Jira projects setup for the plugin projects (thanks Jonathan!), so feel free to add any issues that you come across. Or if you're game, connect to the Subversion repository and have a hack
Cheers,
Ross
May 01, 2007
Bob Swift says:
Ross, thanks for providing these plugins. I agree with the above suggestions and...Ross, thanks for providing these plugins. I agree with the above suggestions and like the idea of the threshold. I would like to see the option for the threshold violation to cause the build to fail.
May 01, 2007
Andreas Knecht says:
I think that would be a great feature to have as well. Otherwise, code coverage ...I think that would be a great feature to have as well. Otherwise, code coverage will just be unnoticed.
I'll add any new feature requests/bugs in the JIRA projects if I can think of anything. I doubt I'll have any time to hack around on this myself in the next couple of weeks (writing code for JIRA is keeping me fairly busy
), although we have a fedex day coming up soon.
May 06, 2007
Ross Rowe says:
Hi all, just letting you know that I've just put up version 0.9.1 of the Cobertu...Hi all, just letting you know that I've just put up version 0.9.1 of the Cobertura plugin. This release includes the ability to specify whether you want notifications sent if the Cobertura line rate exceeds a specific threshold. I'm going to start working on CBRT-1, which is the issue surrounding identifying classes with the most significant coverage changes now, feel free to let me know if there's any other bits of functionality that you'd like to see.
May 07, 2007
Ross Rowe says:
Hi again, I've put up version 0.9.2 which now includes showing the significant c...Hi again, I've put up version 0.9.2 which now includes showing the significant coverage changes since the last build (ie. increases/decreases in coverage). I still need to do a little bit of work in sorting the list, and perhaps having separate sections for increases/decreases. Let me know what you think
May 07, 2007
Andreas Knecht says:
Sounds good. I'll give it a workout on the JIRA Bamboo instance and will let you...Sounds good. I'll give it a workout on the JIRA Bamboo instance and will let you know how it goes
.
Looks good from the screen shots though! Nice work.
May 08, 2007
Andreas Knecht says:
I'm getting this at the moment after the build finishes: java.lang.NullPointer...I'm getting this at the moment after the build finishes:
Doesn't break anything, but the error shows up in the Bamboo System Errors list. I didn't set any post notifications for my build. Simply dropped the new version of the plugin into the Bamboo lib directory.
May 08, 2007
Ross Rowe says:
Hi Andreas, thanks for letting me know about the error, I've just put up version...Hi Andreas, thanks for letting me know about the error, I've just put up version 0.9.3 which should fix the error.
Cheers,
Ross
May 08, 2007
James Odeen says:
I'm having some issues getting it set up in my plan. My ant script uses the cobe...I'm having some issues getting it set up in my plan.
My ant script uses the cobertura-report task to create an xml report in the dist\reports\coverage\xml directory called coverage.xml
<cobertura-report format="xml" destdir="dist/reports/coverage/xml" srcdir="src/java"/>Now in the setup for my build plan, what do I have to set the "Cobertura XML Directory" to?
I've tried:
All with no luck. When the build runs, it has the "% Line Rate" and the "% Branch Rate" both as 0% (even though my coverage.xml has non-zero values for those)
Am I missing something simple here?
I've even tried using the test-cobertura-report.xml that is used as part of the plugin tests (I just checked it into my repository and pointed my "Cobertura XML Directory" directly to it).
I'm using 0.9.3 of the plugin on bamboo 1.1 (had the same problem in 1.0.5) and cobertura 1.8.
Thanks.
May 08, 2007
Ross Rowe says:
Hi James, thanks for letting me know. It sounds like the build processor can't f...Hi James, thanks for letting me know. It sounds like the build processor can't find the coverage XML file. I've just put up version 0.9.4 which includes a little bit more logging. Would you be able to check the bamboo.log file to see if lines similar to the following are appearing?
If you don't see a 'Parsing File' log entry, then the build processor wasn't able to locate the coverage XML file. I was also running into problems because we are running our builds offline, and the XML parser is attempting to validate the Cobertura DTD, so I had to remove the DTD from the Coverage XML file in our Ant task.
Let me know how it goes, feel free to send me an email at piaross at gmail dot com if it's still causing problems.
Cheers,
Ross
Jul 18, 2007
Stuart Martin says:
maybe I caught you midupdate, but the supplied jarfile 1.0.1 doesn't work with p...maybe I caught you mid-update, but the supplied jarfile 1.0.1 doesn't work with product 1.2 (if it is relevent, the plugin xml file inside the jar says 1.1 max)
Jul 18, 2007
Ross Rowe says:
Hi Stuart, the 1.0.1 version should support Bamboo 1.2, perhaps you could try ag...Hi Stuart, the 1.0.1 version should support Bamboo 1.2, perhaps you could try again and if it still isn't working, raise a Jira issue with details of the error? I forgot to update the atlassian-plugin.xml file to reflect the support for 1.2, and I'll make this change ASAP (although I don't think this should affect the plugin not working)
Thanks,
Ross
Jul 26, 2007
Geoffrey Wiseman says:
I've got Bamboo 1.1.2 and {{coberturabamboo1.0.1.jar}}. The former is installed ...I've got Bamboo 1.1.2 and cobertura_bamboo-1.0.1.jar. The former is installed in /opt/tomcat/webapps/bamboo (*.ftl, admin/, reports/, etc.), and works in
/opt/bamboo (bamboo.cfg.xml, bamboohome, database).
Based on the instructions above, I put the cobertura_bamboo-1.0.1.jar in /opt/tomcat/webapps/bamboo/WEB-INF/lib.
I restarted tomcat, but there's no sign of Cobertura in the builder configuration. Did I do something wrong, put the file in the wrong place? Did I miss another step? How can I diagnose the issue?
Jul 26, 2007
Ross Rowe says:
Hi Geoffrey, are there any error messages appearing the bamboo.log file? You mig...Hi Geoffrey, are there any error messages appearing the bamboo.log file? You might want to try the cobertura-bamboo-1.0.0.jar file if you're using Bamboo 1.1.2. The 1.0.1 jar file only supports Bamboo 1.2.x (due to changes in the core Bamboo API classes). Feel free to send me an email to discuss further.
Cheers,
Ross
Jul 27, 2007
Geoffrey Wiseman says:
Yup 1.0.0 works fine under 1.1.2; thanks\! I'll upgrade to 1.0.1 when we u...Yup 1.0.0 works fine under 1.1.2; thanks! I'll upgrade to 1.0.1 when we upgrade Bamboo.
Oct 30, 2007
Vincent Thoulé says:
Hi Ross, I try to cconfigure your plugin using Bamboo 1.2.3, Maven 2.0.7 as Bui...Hi Ross,
I try to cconfigure your plugin using Bamboo 1.2.3, Maven 2.0.7 as Builder and org.codehaus.mojo:cobertura-maven-plugin:2.0 for Cobertura engine.
For information org.codehaus.mojo:cobertura-maven-plugin:2.1 with Cobertura 1.8 engine fail with Maven2.
org.codehaus.mojo:cobertura-maven-plugin:2.0 provides Cobertura 1.7 and seems to be OK.
Then, with your plugin (1.0.3) I am not able to see the Notification configuration panel, neither the Code Coverage build results (screenshots 10 and 11). Ony raw data are available in the Metadata panel.
Any idea.
Oct 31, 2007
Ross Rowe says:
Hi Vincent, I'll attempt to replicate your error and see if I can fix things. Wi...Hi Vincent, I'll attempt to replicate your error and see if I can fix things. With regards to the notification logic, the underlying notification scheme used by Bamboo has changed since the plugin was first developed, and I ha haven't gotten around to updating it. If you could add a Jira issue to capture this, that'd be great!
Thanks,
Ross