Continuous integration

This developerforce article introduces the subject in the context of

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:


13 thoughts on “Continuous integration

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

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

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

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


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

      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.


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

  7. I ran the this code and for some reason i get an Error message, stating – Failing task since test cases were expected but none were found.

    Anyone ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s