Integrating Quick Test Pro with Cruise Control
For those that have worked on an Agile project most would agree that integrating automated test cases with continuous integration is imperative. It provides regular feedback not only on the application but also on the tests themselves. Small iterative changes are easier to manage then large updates. There are challenges keeping the build time reasonable as well as ensuring the environment is up to date and kept in line with the latest code, but that is for another entry. Here I will talk about how to integrate Quick Test Pro (QTP) with Cruise Control. As tests written in Quick Test Pro quickly get to the stage where they are taking hour(s) to run I suggest you create a separate test build to the development (code) build.
There are different ways to integrate QTP and Cruise but this is one I first used with Winrunner. It does require another Mercury product, being
There are of course drawbacks to this approach (apart from the cost of the tools!), for example the test results are not communicated back to Cruise (only a pass/fail result). By using
Below is a sample build.xml file which demonstrates a call to TDTestSetRun and fails if a file exists.
<project name=”Example” default=”runtest” basedir=”.”>
<description>
simple example build file for calling QTP or Winrunner tests in
</description>
<!– set global properties for this build –>
<property name=”TDRunTestDir” location=”C:\TDTestSetRun”/>
<target name=”init”>
<delete file=”${TDRunTestDir}\TestFailed.txt”/>
</target>
<target name=”runtest” depends=”init”
description=”Run test set from Quality Center” >
<exec executable=”${TDRunTestDir}\TDRunTestSet.exe” output=”${TDRunTestDir}\Result.txt”>
<arg line=”/s:http://qulaitycenterserver/qcbin”/>
<arg line=”/n:Domain”/>
<arg line=”/d:Project Name”/>
<arg line=”/u:username”/>
<arg line=”/p:password”/>
<arg line=””/t:Automated Tests””/>
<arg line=”/f:Root\Folder\”/>
<arg line=”/l”/> <!–This option is to run the QTP tests locally.–>
</exec>
<fail message=”Tests Failed, see Quality Center for more information”>
<condition>
<available file=”${TDRunTestDir}\TestFailed.txt”/>
</condition>
</fail>
</target>
</project>
Cruise will call Quality Centre to execute the tests in the test set that you target. The application will need to already be deployed and running, this is normally done as part of the cruise build, after the code has been unit tested and compiled.
I don’t understand how do you execute tests? Cruise doesn’t deploy application to be tested, does it?
Thanks
This should work with either edition of QC, it uses the API to connect to QC which I believe is available for both the starter and Enterprise Editions. There is a better way to do this, I have found tdruntestset.exe to take up a lot of CPU when it is running, I think it sits and polls for the result. I will put up another blog soon about the other way which involves writing your own script that uses the API.
hi there- will the starter edition of QC do or do we need the Enterprise edition to make this work?
I would like to see a continuation of the topic
Way back when, when I first got involved with CruiseControl, I did something similar run our WinRunner tests under CC, but then went a step further. I wrote a custom Ant task that would read in the contents of the error file and create an XML result file that matched the JUnit format. I’d then have CC merge that into the log and now the WinRunner error messages showed up in the CC email just like the JUnit error message. Was very handy!