This developerforce article introduces the subject in the context of Force.com.
But it neglects to mention that some changes fail to deploy and that there is no way to “clean” an existing environment. (See and vote for the sf:clean — new task for ant-saleforce.jar idea.) So every few days occasionally when we make such a change we have to go and create a new account and switch to that. This is 10 minutes of annoying and unnecessary manual intervention.
We use Hudson Jenkins and have made a small extension to the com.salesforce.ant.DeployTask (available as a Google Code project) so that it outputs a basic JUnitReport format XML file of the test and coverage results. This integrates nicely with Hudson’s Jenkins’ test reporting – providing details of each test plus code coverage data – including with the test result trend graph:

Hi,
I am looking into integrating SF with CI, I am now trying out both CC and Hudson. Would be helpful if you can mail/post your code.
Thanks, Jan-Dirk
I’ll email you the code.
Fyi, we moved to Hudson from CruiseControl a while back and don’t regret it. Obviously for salesforce you need very little from such tools.
I would like your extension code as well. We set up CI with Hudson a bit ago. I voted for your idea. Occasionally, we find that tests pass during CI, but fail when we move to our packaging area because of changes that don’t deploy or get cleaned up from a previous deployment. Doesn’t make me trust our CI quite so much.
I’ve put the code and a jar in the Google code project http://code.google.com/p/force-deploy-with-xml-report-task/ so you can now get it from there.
By the way, I posted another idea related to CI and packaging but have low expectations for it: https://sites.secure.force.com/ideaexchange/ideaView?id=08730000000GyymAAC (sf:package — new task for ant-saleforce.jar and other packaging needs).
Thanks for that code. I set it up yesterday. Pretty slick. One question though. The coverage results don’t seem to reflect what I see when I run all tests inside Salesforce. The coverage percentage in the junit report xml file is inflated for a lot of files and total percentage is a whole 5 points higher in the junit report. Have you noticed similar discrepancies?
I voted for your other idea as well. Managed package development and testing seems to be much more difficult than it should be.
Yes I did notice that the coverage numbers are not the same but have not tried to find out why as it is not a priority for me. You can see what the code is currently doing in com.claimvantage.force.ant.XmlReport.coverageSummary; if you come up with a fix let me know and I’ll update the Google Code project.
Rob kindly contributed the fix for this and the fix is included in version 1.1.
Thanks. This was a very helpful post and ANT plugin. I had struggled to set this up with CruiseControl and was disappointed at its inability to handle the junit results. This is a huge step towards making Apex a mature development language/environment. Thanks!
Andrew
Hi,
I am a big fan of your Hudson Ant task! It does exactly what it should and I love the Trend.
Now I would like to send several things by email after each build and don’t know how to do that.
The only thing I have configured so far is the Email-ext plugin to send a report on each build even the successful ones.
What I would like to send:
- Trend graph
- Tests results (not the Hudson console one but the one we see when we click on Test result)
Any help would be appreciate.
Keep up the goow work!
Laurent
Laurent,
My Ant task produces the same XML test report files that the junitreport Ant task does. You’ll have to ask your questions about Email-ext or other Hudson plugins on Hudson-related forums.
Keith
I have one java object. I want use this object as apex object so please help for this. and what are the steps need to follow me.
Kishore, I suggest you start by reviewing articles like this http://www.slideshare.net/Salesforce/introduction-to-forcecom-code-apex, Keith