Name |
Cobertura plugin |
---|---|
Version |
2.2.1 |
Product Versions |
1.2.x,2.x |
Author(s) |
|
Homepage |
http://confluence.atlassian.com/display/BAMEXT/Cobertura+plugin |
Price |
Free |
License |
|
JavaDocs |
|
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.3.jar (supports 2.0.x)/cobertura_bamboo-2.2.1.jar (supports 2.1.x and 2.2.x) |
Download Source |
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.
Upgrading to Bamboo 2.1
The 2.0.3 version of the Cobertura plugin is not compatible with Bamboo 2.1. If you are upgrading from Bamboo 2.0 to 2.1, then you will also need to use the 2.1.8 version of the Cobertura plugin
Usage
- Copy the cobertura_bamboo-2.2.0.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.2.1 |
22 Oct 2009 |
Updated notification logic to be compatible with Bamboo 2.3 and higher |
2.2.0 |
19 Oct 2009 |
Included fix for CBRT-24 |
2.1.8 |
23 Apr 2009 |
Included fix for CBRT-21 |
2.1.7 |
10 Feb 2009 |
Included fix for CBRT-17 |
2.1.6 |
6 Feb 2009 |
Recompiled plugin to support Bamboo 2.1.5 (CBRT-16) |
2.1.5 |
17 Jan 2009 |
Included fix for averaging multiple files (thanks Fuzail!) |
2.1.4 |
27 September 2008 |
Fixed NullPointerException which occurred when no previous successful builds were found |
2.1.3 |
9 September 2008 |
Updated plugin to override default locale if Cobertura report file number format is US based |
2.1.2 |
21 August 2008 |
Included fix for CBRT-14 |
2.1.1 |
11 August 2008 |
|
2.1.0 |
8 August 2008 |
Updated plugin to support Bamboo 2.1 |
2.0.3 |
25 July 2008 |
Ensure that plugin handles locale-specific formatting (CBRT-11) |
2.0.2 |
5 June 2008 |
Updated plugin to work with Perforce repository layout(CBRT-10) |
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 |
Screenshots
Screenshots |
||
---|---|---|
26 Comments
edwin
Hi Ross,
Thanks for the submission! That's awesome!
There are some guys here who were looking for this.
Cheers,
Edwin
Ross Rowe
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.
Andreas Knecht
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
Ross Rowe
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
Bob Swift (personal)
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.
Ross Rowe
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.
Ross Rowe
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
Andreas Knecht
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.
Andreas Knecht
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.
Ross Rowe
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
James Odeen
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
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.
Ross Rowe
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
Stuart Martin
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)
Ross Rowe
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
Geoffrey
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?
Ross Rowe
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
Geoffrey
Yup 1.0.0 works fine under 1.1.2; thanks! I'll upgrade to 1.0.1 when we upgrade Bamboo.
Vincent Thoulé
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.
Ross Rowe
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
Christian Andersson
Hi all,
First of all, this really look nice!
However
I'm trying to use this plugin using Bamboo version 2.0.6 build 808. I have the latest 2.1.2 cobertura plugin. I'm using maven 2.0.7 and jdk 1.6. And I'm using 2.2 of the maven-cobertura plugin specifying xml as a report (Just to make a complete list)
The problem that I see in the Bamboo logs is that the NumberUtils class seems to have changed in this bamboo version, or?
Any help is much appriciated and nice work!
/Christian
java.lang.NoSuchMethodError: com.atlassian.bamboo.util.NumberUtils.padWithZeroes(Ljava/lang/Number;I)Ljava/lang/String;
at com.atlassian.bamboo.plugins.cobertura.CoberturaPostBuildIndexWriter.updateIndexDocument(CoberturaPostBuildIndexWriter.java:41)
at com.atlassian.bamboo.index.BuildResultsSummaryDocumentFactory.getDocument(BuildResultsSummaryDocumentFactory.java:141)
at com.atlassian.bamboo.index.DefaultBuildResultsIndexer.indexBuildResult(DefaultBuildResultsIndexer.java:132)
at com.atlassian.bamboo.build.pipeline.tasks.SaveBuildTask.call(SaveBuildTask.java:69)
at sun.reflect.GeneratedMethodAccessor396.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.orm.hibernate.HibernateInterceptor.invoke(HibernateInterceptor.java:117)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.orm.hibernate.HibernateInterceptor.invoke(HibernateInterceptor.java:117)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy49.call(Unknown Source)
at com.atlassian.bamboo.v2.build.agent.LocalBuildResultProcessor.processBuildResult(LocalBuildResultProcessor.java:99)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:111)
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:101)
at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$1.run(NamedThreadFactory.java:32)
at edu.emory.mathcs.backport.java.util.concurrent.helpers.ThreadHelpers$1.run(ThreadHelpers.java:34)
at java.lang.Thread.run(Thread.java:619)
Ross Rowe
Hi Christian, I think the problem is caused by incompatibilities between version 2.1.x of the Cobertura plugin and Bamboo 2.0.6...there were a couple of changes to the underlying Bamboo API in Bamboo 2.1 which required us to release version 2.1 of the plugin.
Would you be able to try version 2.0.3 of the Cobertura plugin instead? You'll need to make sure that the 2.1.3 version is removed from the BAMBOO_HOME/webapp/WEB-INF/lib directory.
Thanks,
Ross
Christian Andersson
Thanks Ross
That was quick and it works. Very appriciated!
/Christian
blabloe
Great plugin, however I have some odd results using the plugin. On the detailed build tab (of a specific build) I get this for line rate:
9.223372036854776E29% (0%)
and this for branch rate
922337203685477600000000000000000000000000000%
I'm using the XML report from cobertura, this xml report is generated upon a merged SER file (merged using the cobertura ant task).
Ross Rowe
Hmm, that's a weird bunch of numbers, would you be able to send me a copy of the Cobertura report file to piaross at gmail dot com? Could you also let me know what versions of Bamboo/Cobertura plugin you're using?
Thanks,
Ross
Fuzail
Hi Ross
Cool plugin, but we noticed when using it that the averages for line rate and branch rate werent accurate when using more than two coverage reports. We made a patch for it using your latest code of trunk and now it gives accurate results.
Have a look.
Regards
Fuzail Sarang
Silvermoon Business Systems
Ross Rowe
Thanks for that Fuzail, I've included your patch into version 2.1.5.
Cheers,
Ross