Functional Web Services Testing Made Easy with SoapUI - Part 3
3. Integration with CI
Continuous integration is all about compiling, testing, inspecting, and deploying to your application server at each commit. The benefit of CI is simple: when you build software often, you will find code defects early. A lot of CI servers are available, both open source and commercial. Hudson is an open source CI server with a very simple set up, just three steps (yes you heard me right, just three steps):
a. Download the latest version of Hudson.
b. Open a command window and type java -jar hudson.war
c. Open up a browser and go to the url http://localhost:8080
That’s all you need to get the CI server up and running in less than two minutes. You can read more about configuring Hudson and downloading all the plugins and much more at the link here.
As we will now see, it’s very easy to run the functional tests we wrote in this series once we deploy our application to a server. If all the tests run, the build file will generate JUnit reports; these reports can be integrated within our CI dashboard. If any of the tests fail, we fail the build, using the failonerror attribute of the Ant task. Based on how CI has been set up, everyone in the team can receive an email or a text message should the build break.
Let’s take a look at how we run these functional tests and integrate them with CI:
Once you have Hudson installed and running, you must add your projects to Hudson as Jobs for it to monitor these projects. We are going to create a single job which runs at midnight.
1. Go to the Hudson main page, and click New Job. This will open a page as such:
2.Enter a descriptive name since this is the name which will be displayed on the Hudson dashboard. Select the "Build a free-style software project". Click the OK button and you’ll be presented with yet another screen
3. In this screen, select your source code management. You will be presented with a detailed screen based on your SCM. Fill in all the details. Hudson needs all this information to checkout all the source code assets to build the project.
4. Hudson can be configured to build your project on a scheduled basis, or periodically. In our case the job needs to run at midnight. So, here are the changes needed to run the job on a nightly basis.
5. Next step is to configure Hudson to properly build our project using Ant. As you can see from the image above, Hudson provides many ways for building your project. In the PetStore case, I am setting up some environment variables and therefore using a simple batch file.
6. In the Post-Build Actions section, we will select the Publish JUnit test result report option. We are generating the JUnit reports from SoapUI. Specify a location for where Hudson can find the XML files that JUnit produces when run through Ant.
7. Now, that we have Hudson setup. we will force the build. This will cause Hudson to checkout all the source code artifacts from SCM, and initiate a build. In my case the build failed; reason being SoapUI generates the JUnit reports with no package name, Hudson complains about the same and throws a NPE. A possible workaround to publishing the JUnit reports, is to use the Achive the artifacts option in Post-build Actions. Here are the Hudson screenshots and the output:
Hudson console output:
- Login or register to post comments
- 19282 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)










Comments
David Sills replied on Mon, 2008/05/19 - 8:46am
SumaBS replied on Mon, 2008/05/19 - 1:34pm
Sreekant replied on Thu, 2008/05/22 - 3:32pm
hi
I would like to know whether SOAPUI support complextype as input values.
2. whether it provides UI based support of testing Webservices
3. whether it generate test result in the report fasion.
if you have any product which support all these let me know.
Sreek
Meera Subbarao replied on Thu, 2008/05/22 - 4:10pm
Hi Sreekant,
Everything you have asked above is what SoapUI is. Also, the AccountManagerBean code shown in this page has all the methods except remove method return a complex type, which in my case is the Account entity object. And the create method does take Account as its input as shown below.
srimaan replied on Sun, 2008/07/20 - 2:12pm
arazauci@gmail.com replied on Fri, 2008/08/01 - 8:49pm
hi,
I am trying to specify my Test Report XML from soapui
as
C:\Results\2008-08-01_17-32-28\28\report.xml
and I get teh following error in hudson.
What am I doing wrong. why am I getting this error when the report.xml file exists.
tommy.van.mella... replied on Thu, 2008/09/04 - 6:37am
in response to: arazauci@gmail.com
If it is the same cause as in the Test case setup script, then it is the slash.
You used a "backward" slash. It should be a "forward" slash "/" .
Tommy
arazauci@gmail.com replied on Thu, 2009/04/23 - 1:22pm
samanthayan replied on Tue, 2009/06/16 - 9:23pm
sunrise1 replied on Fri, 2009/10/23 - 5:53am
sunrise1 replied on Fri, 2009/10/23 - 5:53am
sunrise1 replied on Sun, 2009/10/25 - 8:48am