ABOUT US

|

SUPPORT

|

BLOGS

 

 

DEVELOPER BLOG

 

 

 

 

 

 

 

Setting up LiquidTest with Subversion and Hudson (Continuous Integration) part 2

 

Anthony Scotney

 

 

 

 

 

This post follows on from part 1 where we walked through the Ubuntu, Subversion and LiquidTest (Eclipse) setup. Assuming that your project is now in your subversion repository we walk through the Continuous Integration setup with the popular (and Open Source) Hudson CI server.

Contents of this blog

  • Setting up Hudson
  • Configure Hudson from the Hudson web interface
  • The liquidtest.properties file
  • The Build File (build.xml)

Setting up Hudson:

1) Create the necessary directory and download Hudson:
mkdir /home/hudson
cd /home/hudson
wget –no-check-certificate http://hudson.gotdns.com/latest/hudson.war

2) Start up Hudson (note Hudson has an internal server that runs on port 8080 by default):
java -jar hudson.war

3) Navigate your Browser to the IP where your server resides and specify port 8080. eg:

http://192.168.161.128:8080/

Configure Hudson from the Hudson web interface

Assuming that you successfully started Hudson and that you have not “firewalled” any ports, you should see the Hudson welcome screen when navigating to http://192.168.161.128:8080 (or your Servers IP address – remember in part 1 we setup VMWare and used NAT).

Setup ANT (the Java build tool)
1) Configure ANT in Hudson: “Manage Hudson” -> “Configure System” -> “Add Ant” (under the Ant heading), give Ant a “name” and point it to your ANT install directory (then Save – the button is at the bottom of page), which in this case (set in part 1) is: /home/apache-ant-1.7.1/

Building your Hudson “New Job”:
1) On the Hudson welcome screen, click on the “New Job” option (on the left-hand menu – see screenshot above).
2) Give your Job an appropriate name and select “Build free-style software project”
3) Click on the “LiquidTestAutomation” (or whatever you called your job) and then click the “Configure” option.

Here we are met with lots of configuration options. To keep things simple I will run through the basic sections and selections pertinent to this setup.

Source Code Management:
1) Select “Subversion”

2) Enter the URL to your subversion server (if you followed the setup above you will need to “enter credentials” aka username:password) eg: http://192.168.161.128/svn/LiquidTestProject/
3) Enter your username and password (when prompted) and Save the project and re-open the Configuration screen (click project, then “Configure”). Note: If you did not save the project you will need to re-enter the SVN location URL (step 2 above).

Build Triggers: “Poll SCM” and add “* * * * *” to poll subversion every minute for changes to your Tests

Add build step: Invoke Ant
Select your “Ant Version” that you configured above
In the “Targets” field, put “runtests” (for more information on “runtests” see below in the build.xml file), and click “Advanced..” and add build.xml as your “Build File”

Post-build Actions:
Check the “Publish JUnit test result report” and add “**/*.xml” to the field.

Save..

Now click on “LiquidTestAutomation” and then “Build Now”. Your project should build and fail..

The liquidtest.properties file

The LiquidTest Server Edition (liquidtest-nodeps-x.x.x.jar) requires a properties file to set the license key. This properties file is named “liquidtest.properties”. Without the liquidtest.properties file LiquidTest will not run. If you do not have a liquidtest.properties file, create one with notepad (or nano!) and add the following line:

licenseKey=<YOUR LiquidTest Server LICENSE KEY>

After entering the license key you should submit this file to subversion, in the root directory of your project (see Part 1 of this blog if you are in doubt).

The Build file (build.xml)

In this tutorial we are using ANT to provide direction to Hudson on what to compile, run and how to report the results. Given that we are using ANT we need to populate our build.xml (download from here..) file with the following and check the file into Subversion in the root project directory (In LiquidTest, click on the file, right-click and select “Team..” and then “Commit..”):

<project name="LiquidTestProject-02-08-09" default="runtests">
	
	<property name="src" value="src" />
	<property name="build" value="build" />
	<property name="bin" value="${build}/bin" />
	<property name="junit.log.dir" value="${build}/log" />
	
	<!-- NOTE: Set the versions of LiquidTest Server and JUnit to the versions you are using -->
	<property name="junit.version" value="4.5" />
	<property name="liquidtest.server.version" value="1.0.11" />
	
	<!-- Creating a target to remove the old compiled code -->
	<target name="clean">
		<delete dir="${build}"/>
	</target>
	
	<!-- The compile step for the tests -->
	<target name="compile">
		<mkdir dir="${bin}"/>
		<javac srcdir="${src}"
	         destdir="${bin}"
	        debug="off"
	         source="1.5">
			<classpath>
				<path location="liquidtest-nodeps-${liquidtest.server.version}.jar" />
				<path location="junit-${junit.version}.jar" />
			</classpath>
		</javac>
		<copy file="liquidtest.properties" todir="${bin}" />
	</target>
	
	<!-- The run step of the build file -->
	<target name="runtests" depends="clean, compile">
		<mkdir dir="${junit.log.dir}"/>
		<junit showoutput="true" failureproperty="test.failed" printsummary="true" fork="true">
			<!-- Setting up our Java classpath -->
			<classpath>
				<pathelement path="${bin}"/>
				<pathelement path="liquidtest-nodeps-${liquidtest.server.version}.jar"/>
				<pathelement path="junit-${junit.version}.jar"/>
			</classpath>
			<formatter type="xml"/>

			<!-- building a task for all .java files -->
			<batchtest todir="${junit.log.dir}">
				<fileset dir="${src}">
		            <!-- Add includes and excludes to select which tests to run ** means any directory -->
					<include name="**/*.java" />
				</fileset>
			</batchtest>
		</junit>
		
		<!-- Specifying a task for LiquidTest Script (Groovy) tests -->
		<runliquidtest todir="${junit.log.dir}">
		    <fileset dir="." includes="**/*.lqt"/>
	        <classpath>
	        	<pathelement path="${bin}"/> <!-- NOTE CHANGED THIS FROM bin -->
				<pathelement path="liquidtest-nodeps-${liquidtest.server.version}.jar"/>
	        </classpath>    
		</runliquidtest>
	</target>
	
	<taskdef name="runliquidtest" classname="com.jadeliquid.liquidtest.ant.scripting.RunLiquidTestsTask">
	    <classpath>
	    	<pathelement path="${bin}"/>
			<pathelement path="liquidtest-nodeps-${liquidtest.server.version}.jar"/>
	    </classpath>    
	</taskdef>
	
</project>

 

 

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • DZone
  • TwitThis
  • email
 Comments (0)

 

 


 

 

No comments yet

Add Comment..

 

 

About this blog..

 

This is an informal place for the team at JadeLiquid to discuss software, the rotation of the earth and other things usually discussed in the JadeLiquid corridors.

 

 

 

Subscribe: By Feed  By Email

 

 

 

 

 

Categories

 

 

JadeLiquid

LiquidTest

 

 

Software Testing

 

 

WebRenderer

 

 

 

 

Recent Posts

 

 

Selenium 2 / WebDriver support coming soon to LiquidTest..
Running Selenium Tests from the Command Line
LiquidTest 3.0 with Selenium support ships!
Setting up Atlassian Bamboo to run automated Web 2.0 tests
888 installer builds and 7469 code checkins later LiquidTest 2.0 ships!

 

 

 

 

 

Popular Posts

 

 

Testing complex Ajax content
Running Selenium Tests from the Command Line
Setting up LiquidTest with Subversion and Hudson (Continuous Integration) - part 1
Creating Data-Driven Functional Tests with LiquidTest
One tool to rule them all - Reducing team division
Setting up LiquidTest with Subversion and Hudson (Continuous Integration) part 2
Is manual testing crippling your development project?
Eclipse and LiquidTest UI Introduction
Protecting investment: Tests that do not break with page changes
Testing Dynamic Elements – Having a Plan B

 

 

 

 

 

Archives

 

 

May 2011 (2) April 2011 (1) November 2010 (2) March 2010 (1) February 2010 (1) November 2009 (1) October 2009 (1) September 2009 (2) August 2009 (1) July 2009 (1) June 2009 (1) April 2009 (1) March 2009 (1)

 

 

 

 

 
   News / Events

 

 > LiquidTest EOL Announcement - Info
 > LiquidTest Release 3.0! - Available
 > Visual Studio Plugin Released! - Release
 > Cruise Control .NET Integration - Info
 > Automate your Dev/Test Process - Webinar
 > Is manual testing crippling your project? - Blog
 > Testing complex Ajax content - Blog
 
 
   Recently Added Content  
 
 > Run LiquidTest's on Selenium RC/Server - Info
 > Setting up LiquidTest with Maven - Blog
 > Officially Supported Ajax Frameworks - Info
 > Atlassian Bamboo Integration - Tech
 > Setting up LiquidTest with SVN and Hudson - Blog
 > Creating Data-Driven Functional Tests - Blog
 > Reducing Test Maintenance - Blog
 
 
  Copyright JadeLiquid Software - 2014