function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
cgosscgoss 

Hudson Integration - Any Interest?

We're thinking seriously about using Hudson (http://hudson-ci.org/) to automatically run our APEX unit tests on a nightly basis and distribute the results if tests failed or coverage drops below a certain percentage.

 

Is there any interest in participating in this project if we make it open source? Since Hudson is open, we'd be inclined to contribute back to the community.

 

Is anyone else doing something like this on some other CI tool like CruiseControl? We currently have a cron-based java solution for it running on a dev box, but we'd really like to take advantage of the trending and build-status tools that hudson provides.

dirkpuisdirkpuis

Since hudson can execute ant scripts or any command line tool, I don't think you will need anything extra to build/deploy/test from hudson. Going to need this myself pretty soon, so I'll post my experiences with it.

saasforcesaasforce

Did you get a chance to set up Hudson integration? Can you please share your experience/issues faced?

cgosscgoss

Yes, we did get it working pretty well. We're using force-deploy-with-xml-report-task to do code coverage analysis.

 

It was pretty simple:

  • create a project that has a package.xml inside a directory called emptyPkg like this
  • <?xml version="1.0" encoding="UTF-8"?>
    <Package xmlns="http://soap.sforce.com/2006/04/metadata">
        <version>20.0</version>
    </Package>
    
    
  • and build.xml like this:

  • <project name="Apex Unit Test Runner" default="runTestsAndReport" basedir="." xmlns:sf="antlib:com.salesforce">
    
        <property file="build.properties"/>
        <property environment="env"/>
    
    	<target name="runTestsAndReport">
            <taskdef
                name="sfdeploy"
                classname="com.claimvantage.force.ant.DeployWithXmlReportTask"
                />
            <delete dir="test-report-xml" quiet="true"/>
            <sfdeploy
                username="${sf.username}"
                password="${sf.password}"
                serverurl="${sf.serverurl}"
                deployRoot="emptyPkg"
                runalltests="${sf.runAllTests}"
            	logType="${sf.logType}"
            	maxPoll="${sf.maxPoll}" 
    			pollWaitMillis="${sf.pollWaitMillis}" 
            	junitreportdir="test-report-xml"
                />
    
        </target>
    
    </project>
  • in ant-lib dir, include the ant-salesforce.jar and ant-deploy-with-xml-report-task.jar
  • Check in all this stuff into your repository of choice
  • Create a Hudson project that checks out this project and executes an ant command like this:
  • -lib
    ant-lib
    runTestsAndReport
  • We use ant properties in Hudson to set sf.username, password, etc. so it's easy to run tests on multiple orgs with the same project
  • Under Publish JUnit report, you can add this:
  • TestRunner/test-report-xml/*.xml

This has worked well for us. We run it nightly, as we have over 650 tests, and it locks the org while they're running.

 

saasforcesaasforce

Thanks for sharing the details. It was very useful.