One of the most powerful features of LiquidTest is its “out of the box” integration potential. Because LiquidTest utilizes industry standard languages (such as Java) and Unit testing frameworks (such as JUnit) the integration possibilities are not limited by vendor-specific frameworks. The purpose of this tutorial is to give those not familiar with Continuous Integration servers a quick “heads up” on the potential and usefulness in automating the running LiquidTest Test Cases on headless servers. This tutorial is in no way meant to be a “How-to” guide on how to setup a secure server. I am deliberately not going into securing the server as it is not within the scope of this demonstration.
- Setting up a test server
- Setting up LiquidTest and connecting (Eclipse) to Subversion
- Part 2 – Setting up Hudson Continuous Integration Server
Setting up a test server
Note: If you already have a server and subversion repository you can skip this section entirely and view part 2 (the Hudson setup). I have setup a VMware instance (using NAT for the networking option) of Ubuntu Hardy Heron (8.04) with only SSH installed by default. The first thing that one needs to do is prepare this machine’s environment:
1) Download and install Java: I recommend using the Aptitude manager to perform installations (note I am running as a super user “su”, if you are against this use “sudo” before each command):
aptitude install sun-java5-jdk
2) Install Subversion (repository to store tests): Follow the great article from David Winter on setting up Subversion: http://davidwinter.me.uk/articles/2006/02/16/subversion-over-apache-2-on-ubuntu/
3) Download and setup ANT: Hudson requires ANT as its make file/build tool.
Untar the ANT libraries (in this case I untar to /home):
tar -zxvf apache-ant-1.7.1-bin.tar.gz
Chown the ANT directory:
chown -R www-data /home/apache-ant-1.7.1/
Set the ANT_HOME environmental variable (assuming they reside in /home):
bash -c “echo ANT_HOME=/home/apache-ant-1.7.1/ >> /etc/environment”
Reboot and check $ANT_HOME:
Congratulations! Your Ubuntu server is ready for Hudson..
Setting up LiquidTest and connecting (Eclipse) to Subversion
First we need to ensure that we have the correct setup of LiquidTest within the Eclipse environment. Because we are going to deploy LiquidTest test cases to a server we need to use the LiquidTest Server Edition (also known as liquidtest-nodeps-1.0.x.jar – downloadable from the LiquidTest downloads page). The LiquidTest Server Edition is a de-coupled version of LiquidTest that includes all necessary files (dependencies) to run your LiquidTest scripts.
4) Setting up your LiquidTest Project
The next steps in this tutorial assume that you have either created a new Project (within LiquidTest/Eclipse) or you are using the default project that ships with LiquidTest.
1) Download LiquidTest Server Edition (www.jadeliquid.com) – ensure that you have a LiquidTest Server Edition license key (contact us if you need one). Your Developer/Tester key will not work.
2) Extract the LiquidTest Server Edition archive
3) Copy the liquidtest-nodeps-1.0.x.jar to your workspace project directory (if you are unsure of the location of this directory, right-click on your LiquidTest project and select Properties, which displays the location of your workspace and project).
4) If you are using JUnit (version 4.5 is what we are using for this blog), copy the junit-4.5.jar (available from here..) across into your project directory (within your workspace).
5) Refresh your project (right-click and refresh) and the liquidtest-nodeps.xxx.jar and the junit-xxx.jar’s should appear.
6) In your Project’s directory create a file (File -> New -> Other.. -> General -> File) called “liquidtest.properties” and a create another file called “build.xml”
7) Refresh your project and make sure you can see all the files you have added (see below for how your Project should look):
5) Install Subclipse into Eclipse:
To be able to connect to our subversion repository we need to install subclipse. Subclipse is a plugin for Eclipse (LiquidTest) that helps to commit and synchronize files with the subversion repository.
1) Navigate to Help (menu) -> Software Updates -> Available Software
2) Click “Add site” and add: http://subclipse.tigris.org/update_1.6.x
3) Expand the “http://subclipse.tigris.org/update_1.6.x” option and check the “Core SVNKit Library” + “Subclipse” and click “Install..”
4) Read and accept the licenses (if you agree )
5) Restart Eclipse/LiquidTest
6) Add your Project to the Subversion repository:
1) Right click on your Project and select “Team” -> “Share Project..”
2) Choose the “SVN” option. If you do not have it, then see the steps above (Install SVN into Eclipse)
3) “Create New Repository location” – Insert the following:
http://<IP of the machine that you installed subversion on>/svn/
NOTE: if you get an error with step 2 above, it is most likely due to the fact you have not added “/svn/” on to the end of the IP address. Remember that Apache is helping to serve Subversion, so you do not have to worry about the “fun and games” with svn+ssh.
4) Select “projects name as folder”
5) Share the project.. and right click and commit your Java tests, so in this example “LiquidTestExample.java”
Note: You must also commit your liquidtest-nodeps-1.0.x.jar (this is the LiquidTest Server Edition library), junit-4.5.jar and your “liquidtest.properties” file (all this file has in it is “licenseKey=” and your license key), and a build.xml (dummy file – see part 2 for the details) file into the repository.
7) Your project should now be in Subversion! Congrats!
You can see what files are in Subversion by the small yellow cylinders next to their icons (below). You can also check what files are in your subversion repository by navigating to http://192.168.161.128/svn/ (if you used the setup method above). This will give you a listing of all files in your Subversion repository.
Part 2 continues on and walks through the Hudson (Continuous Integration) setup..