QTP/UFT – Executing automated test scripts using Jenkins

This article outlines the integration of HP’s QTP (now it is called UFT) & Jenkins. This article provides the details in a very high level. I might not be able to cover all the benefits we could get, by integrating UFT with Jenkins, in this article. So, I have created separate posts in this site to provide more information for you and added links in this post. So, Please check out all the posts to get the detailed idea of UFT-Jenkins integration.

What is Jenkins?

While developing a software, developers might check-in their code very often a day (at least once). This integration should be verified (using build tools, unit & integration tests) to ensure that software is not broken/developers do not introduce any defect. This process is called Continuous Integration & It is development practice to detect these code integration related issues as early as possible in the software development life cycle. Jenkins is a Continuous Integration tool which does this verification periodically or whenever the developer pushes the code to the repository.

Have you ever used Windows Task Scheduler? For ex: If you need to backup a file daily @ 9PM / You need to delete some files periodically, You can come up with a batch file/VBScript to do these simple tasks. Then you can use Windows Scheduler to launch this script @ scheduled time (every hour/daily/weekly..etc). So that you do not need to invoke it manually.

Jenkins can act like this task scheduler which can pull the source code from your source code manager & do a specific task on it. Like compiling the source code, executing the scripts etc. Once the task is done, Jenkins can also archive the results, sending out an email to the team members.

Jenkins is a web based application, totally FREE & Open Source. Check this link to install.

Jenkins-QTP Setup:

  • Automation engineers push their changes to the SVN/Git/ALM.
  • Jenkins can trigger a test whenever a commit was made / periodically / manually by the user.
  • Jenkins gets the latest code from the source control system, deploys it in the Slave machines.
  • Jenkins executes the test in the Slave machines, archive the results.
  • User can see the results in Jenkins directly.


To do the above setup, Lets do the following…

Creating a simple QTP script:

The very first step in this integration is to have a QTP script. Ensure that your QTP test script is working fine.

I have created a simple QTP script & uploaded in GitHub. You can use that as well. Please check here.

Creating a Simple runner file:

QTP can be automated programmatically using its COM interface.  Using this COM interface we can launch QTP, run a test, store the results in a specific location etc. This COM library is registered in your machine when you install QTP.

I am creating a simple runner.vbs file as given below.

'Create QTP object
Set QTP = CreateObject("QuickTest.Application")
QTP.Visible = TRUE

'Open QTP Test
QTP.Open "QTP Test Path", TRUE 'Set the QTP test path

'Set Result location
Set qtpResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtpResultsOpt.ResultsLocation = "Result path" 'Set the results location

'Run QTP test
QTP.Test.Run qtpResultsOpt

'Close QTP
  • I save this as “runner.vbs” in this location “c:\workspace\qtp-jen\” in my machine.
  • Open command prompt – Enter below command by updating the path for the runner.vbs.
CScript "c:\workspace\qtp-jen\runner.vbs"

Ensure that this runner.vbs works fine. It should launch QTP, runs the test and store the results in the specific location.

Creating a Jenkins job:

I assume you have installed Jenkins. If not, please check this link to install.

Create a simple freestyle job. I am naming this job as QTP_JOB


In Job details page, Add a build step as given below. It should be ‘Execute Windows Batch Command



Add the Batch Command.  CScript ‘path of the runner’  [ CScript “c:\workspace\qtp-jen\runner.vbs” ]

It is basically the same command whatever you give in your command prompt to run the vbs file.


This should do to run the QTP test.  (Jenkins can pull the QTP script from source code manager like ALM/SVN/Git etc.  But I assume we have the script in the local machine. Our aim is just to run QTP script using Jenkins to see how it works. For version control system integration – please check here – Github / SVN integration for UFT scripts.

Running UFT Scripts:

Click on the Build Now to launch QTP & run the test. [Our aim here is to create a simple Jenkins job. We can also send parameters to the UFT scripts through Jenkins UI. Please check here – Passing Parameters to UFT test from Jenkins]



Archiving Test Results:

runner file can be updated to apply the xsl to covert the XML result to HTML. Once the result is created, Jenkins job we had created can be modified to archive the test results as given below. Files to archive should be relative path to the workspace. Under my workspace/project directory, I have my results in output folder in this file -> ‘TestResult.html ‘.  It can be archived as shown here.


Jenkins will move the files to be archived to the Jenkins server and maintain it for future reference.

Sending Out Email with Test Results:

You can also send out test results in email to the entire team. Please check here for more details.


Remote Execution:

  • To do remote execution, you need to have another machine in the same network with QTP installed.
  • Follow this guide to connect the machine to the Jenkins master you had installed.
  • Once the remote machine [Slave machine in Jenkins terms] is ready, Jenkins master can issue commands to the slave machines to do some tasks. [I have 16 machines connected to my Jenkins master]
  • Update the QTP_JOB configuration.
    • Click on Configure
    • In the Jenkins job details page – ‘Restrict where this project can be run’ – Label expression should be the name of the slave you had given in the Jenkins.
  • Lets assume you have the root directory set as ‘c:\jenkins‘ in the slave machine. The Job name we have created is ‘QTP_JOB’.  Jenkins will execute this job by default under this location – ‘c:\jenkins\workspace\QTP_JOB‘ in the slave machine. [It can be overriden].
  • Copy all your scripts to the slave machine manually to the location c:\jenkins\workspace\QTP_JOB. [that is runner.vbs is present in this location]
  • ‘Windows Batch Command’ should be just ‘CScript runner.vbs’ as Jenkins will by default look for the executables under c:\jenkins\workspace\QTP_JOB.
  • Click on Build in Jenkins.
  • Jenkins will invoke the runner.vbs in the slave machine which in turn starts QTP & executes the script.

Great!! Now, you can just click on Build from Jenkins whenever you need to execute the script. Jenkins can take of the script execution remotely while you are busy doing something in your machine.


Note: Sometimes an existing QTP/IE/excel running process in the remote machine will affect new test we do. So update the runner file to kill all process first and start a fresh process. My runner.vbs is almost as shown here.


'To terminate all the processes in the machine
Call KillProcess("UFT.exe")
Call KillProcess("QtpAutomationAgent.exe")
Call KillProcess("iexplore.exe")
Call KillProcess("chrome.exe")
Call KillProcess("firefox.exe")
Call KillProcess("werfault.exe")

'Create QTP object
Set QTP = CreateObject("QuickTest.Application")
ConsoleOutput("Launching QTP Application")
QTP.Visible = TRUE

'Open QTP Test
ConsoleOutput("Opening Test....")
QTP.Open "QTP Test Path", TRUE 'Set the QTP test path

'Set Result location
Set qtpResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtpResultsOpt.ResultsLocation = "Result path" 'Set the results location

'Run QTP test
ConsoleOutput("Starting to run....")
QTP.Test.Run qtpResultsOpt

'Close QTP
ConsoleOutput("Execution Completed Successfully!!!!!!!!!!")
ConsoleOutput("Terminating QTP....")

Sub KillProcess(ByVal ProcessName)
	On Error Resume Next
	Dim objWMIService : Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
	Dim colProcesses : Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name='" &  ProcessName & "'")

	ConsoleOutput("Terminating Process : " & ProcessName)
	For Each objProcess in colProcesses
		intTermProc = objProcess.Terminate
	On Error GoTo 0
End Sub

Sub ConsoleOutput(ByVal MessageToBeDisplayed)
	WScript.StdOut.WriteLine Time() & " :: " & MessageToBeDisplayed
End Sub


Version Control System:

We can not manually move all our scripts every time to the slave machines. So you can use VisualSVN server [It is FREE] as the source code repository. Jenkins can pull the latest code from the Subversion/Git/CVS/ALM etc & deploy it in the slave machines, execute the script for you.

Update the repository URL details under Source Code Management in the Jenkins Job [Ex: QTP_JOB].


  • Check here for more details on using Source Code control system like GitHub.



We saw a very basic jenkins-qtp setup.

We will be able to do many advanced things with qtp/uft-jenkins if we have a proper framework in place.


Running a set of tests in different browser or environment (like QA, DEV, PROD) using Jenkins. We can configure Jenkins to pass parameters to the QTP test as shown here.



Please check below posts to implement few process/productivity improvements in your organization/project.

  1. Passing Parameters to UFT test from Jenkins
  2. Github / SVN integration for UFT scripts
  3. Automated Smoke Test
  4. Continuous Regression Test
  5. Showing test execution progress in the Jenkins Console



Happy Testing 🙂


Share This:

Categories: Articles, Best Practices, CI / CD / DevOps, Jenkins, QTP


  • Vinu Venkatesh

    Hi, This article is very interesting. I have a clarification on migrating the existing tests in ALM to SVN and integrating them with jenkins.
    we have the test sets in ALM (Test lab) and we call these tests using a kind of ‘runner.vbs’ file where in we provide the testset name and it will execute the particular test set and the results are shown in ALM.

    My query is how can I integrate individual tests into a Testset in SVN and run it in jenkins.

    Appreciate your help on this.

  • Mark

    Where can I get the updated code to the runner.vbs script that does the following:
    “runner file can be updated to apply the xsl to covert the XML result to HTML. Once the result is created, Jenkins job we had created can be modified to archive the test results as given below.”
    Adding the “Post Build” action/values in Jenkins is easy enough but what about the code updates to the runner.vbs?

  • Manjunath

    Hi I am trying to execute ALM script through Jenkins.
    I have few doubts,
    * One “TestSet” has multiple scripts, can we run individual test through Jenkins?
    *My requirement is I have one test set in ALM which has 20 test cases, I need to execute all 20 test cases using Jenkins parallel execution mechanism, how to achieve this?
    * what are the advantages of running jobs from Jenkins over Running directly from ALM?

  • Sreekanth Mallela

    Hi, This is excellent article.

    We are facing one issue while integrating UFT with Jenkins. To execute our UFT scripts from Jenkins server (which is in Linux box) through ALM server. Since HP is not supporting on Linux environment (to execute . exe file) we have created a Master & Slave configuration in Jenkins and it is working fine now.

    Execution is happening successfully only when Slave machine is in unlocked state. But when the Slave is in locked state, it is throwing an error as “The server process could not be started because the configured identity is incorrect. Check the username and password”.
    How can we execute UFT scripts in locked machine or the process to unlock the machine automatically before going to start the automation execution.
    Thanks for your replay

    • vIns

      Yes, UFT does not work as expected when the machine is locked. We have set it to ‘never sleep’ mode.

  • boxfon.ru

    Thanks for sharing the wounderful info, I am new to Jenkins while searching for end to end configuration got your post, really good info. I had placed the UFT script by using HP file system but I had provided the path of the script which needs to execute but we have not defined to launch the QTP right so will test fail?

  • Carlos


    This post looks great.

    I understand how Jenkins can kick off the QTP jobs and archive the results, but how will Jenkins be able to interpret the results so that we can mark the Jenkins job as a failure and send an email to interested parties?


    • vIns

      Yes. I am already doing it!

      You can use the “Reporter.RunStatus” to get the result and store it in an environment variable.

      Access the environment variable in the runner file. based on the value – add this statement in the end

      If it fails, WSCript.Quit 1 – this will make the build failed
      If it passes, WScript.Quit 0 – this will make the build pass

  • dane smith

    Good afternoon
    i am wanting to use a version control for the automated scripts stored in ALM, is it possible i can have GIT as my Version control so that i can have many versions of the same scripts so can run execution on multiple versions of software? if so how can i set this up
    thank you

    • vIns

      I use Git for my QTP/Selenium/JMeter scripts. You will love it once you start using it.

  • Rambbau

    Hi , I am trying to execute uft web application script from jenkins , but execution is is too slow compare to local machine execution , when i execyte oracle form scripts form jenkins execution is fine as without jenkins execution , can you please help anyone has idea what is reason for slow execution .

    • vIns

      Jenkins is a just a scheduler. I do not think it would cause some issues for UFT slow execution. Check the remote machine plugins-enabled for the UFT. Too many plugins would cause slow execution.
      BHOManager.dll add-on should have been enabled in IE.

  • Thanuja

    blog looks good
    currently my UFT code is in GIT, i want to integrate GIT with Jenkins. I am facing a error saying “ERROR: Error fetching remote repo ‘origin'” , so could you please guide me what are setting needed to be done from GIT and Jenkins side , so that scripts starts working

    • vIns

      It is very generic error and the reason could be anything.Even the workspace does not have any enough space, you might get this error. Please raise it in StackOverFlow.com

  • Kesava Krishna Pinnamani


    I’m trying to setup Jenkins so that it pull the QTP Script from SVN directly
    But I’m not able to do it. Could you please tell how to do this?

  • sagar

    Dear Sir,

    Such a nice and detailed article for UFT-Jenikns integration, thanks alot.

    I have a requirement for my new project: We will have our Automation to be triggered from ALM. But how can we integrate Scripts in ALM with SVN.
    We are a team of 4 members.

    Please let us know the solution.


    • vIns


      SVN is the version control system for your source code. ALM also acts as a version control system. But SVN and Git has more features compared to ALM.

      10 years ago, We all used to trigger QTP test from ALM so – integrating QTP scripts in ALM made sense. Now we use Jenkins a lot and We do not trigger from ALM. So, I was looking for something better. So I started using SVN/Git.

      Remember Jenkins can be integrated wiht ALM. Ie, you can store all your scripts in ALM. Jenkins will fetch the scripts from ALM for execution.

  • sankar

    I have a resolution problem while running the script via jenkins. I am enable the video record while running the script. I came to know that windows resolution is less than the 800×600. how to resolve the resolution issue in jenkins.?
    how to setup the windows resolution while remote machine invoke?

  • Sarah Syed

    I need to check automation results during the middle of execution in UFT. If I integrate Jenkins wiht UFT 12.53, will I be able to check how many tests have passed and what are failing. This way I do not have to wait for the execution to complete to get my results. Please reply. Thanks.

  • RobL

    Nice article. I see this scripts runs one test. How would you modify the script to run all the tests you wish to run?

    • vIns

      This is to give a high level idea. It can be modified to run all the tests. I have my tests in spreadsheet – runner.vbs will execute all the tests.

  • Kavitha

    This really seems to be a very good article. Thank you so much for valuable information.
    I have a Question,as we can integrate ALM with Jenkins and trigger the script execution,Is it possible to Integrate Oracle Test Manager Tool with Jenkins and trigger the execution?

    Thanks in advance

    • vIns

      I never used Oracle Test Manager. As long as there is an API to programmatically access Oracle Test Manager, there should not be any problem in integrating with Jenkins.

  • Kavitha


    There is no API’s for Oracle Test Manager as such so would like to know if at all it could be integrated with Jenkins for Execution.

    • vIns

      As long as you are able to automate something and run it via command-line, then you should be able to integrate in Jenkins as well.