In this article you will learn how to integrate UFT tests with the Universal Agent.
- UFT 14.03 or higher
- Activate Automation Integration
- Install and Register the Automation Host
- Download the script qtp.vbs used to kick off UFT script at https://github.com/QASymphony/uft-sample-14.03/blob/master/qtp.vbs and put it into the automation host folder, e.g. C:\qtest\agentctl-2.2.1\build\qautomation\lib\qtp.vbs
Click HERE to watch demo video.
Create UFT Universal Agent
- From Launch, open the host machine where you want to create the new agent.
- Select the + New Agent button.
- The New Agent dialog will display.
- Enter the information below for the new agent.
General Agent Information
- Agent Name: name of the agent, e.g. UFT Universal Agent
- qTest Manager Project: select a qTest Manager project from which the agent is going to execute scheduled tests, e.g. qConnect Sample Project
- Agent Type: select Universal Agent
NOTE: If your machine has only C:\ drive, create a new folder to clone UFT project from GitHub e.g test-projects.
if not exist "C:\test-projects\uft-sample-14.03" (
cd /d "C:\test-projects"
git clone https://github.com/QASymphony/uft-sample-14.03.git
) else (
cd /d "C:\test-projects\uft-sample-14.03"
git pull --all
- Select node as the executor.
- Enter the directory where UFT script(s) are located, e.g. C:\test-projects\uft-sample-14.03
We are going to create a script written in NodeJS to:
- scan all the sub folders under Working Directory for .usr scripts and store it in an array
- obtain the automation content(s) of scheduled test runs by resolving the value of magic variable TESTCASES_AC. Refer to this article to learn more about MAGIC VARIABLES in Universal Agent
- if the value of TESTCASES_AC variable is empty, which means there is no test runs being scheduled to be executed (e.g. when this Universal Agent is executed in the first time), we will let the agent execute the all .usr scripts found in step #1, then collect the execution result to create test runs in qTest Manager and submit test logs to those test runs
- if TESTCASES_AC variable has value which are the automation contents of scheduled test runs, we will instruct Universal Agent to only execute .usr script matching automation content
Copy the following script and paste it to the Execute Command editor.
Path to Results
- Enter C:\test-projects\uft-sample-14.03\test-results
- Select Unified Functional Testing (UFT) as the Result Parser.
- If you want the Universal Agent to submit test results to qTest Manager, you must specify values for both Path to Results and Result Parser. Otherwise, you must do that yourself through Execute Command.
The screenshot below shows how the new UFT Universal Agent is configured.
Select SAVE to finish creating the agent. The agent will be available the next time the host machine polls to qTest Launch.
Execute UFT Universal Agent
- Access the host machine where the UFT Universal Agent was created.
- Locate the agent in the Agents list and select the Run now button.
- The Universal Agent execution dialog will display.
- Select the Execute button to kick off the agent execution and you will see the logs shown in the Console Log section. If the execution is successful, you'll see the test run logs being submitted to qTest Manager.
Next, access to qTest Manager. Select qConnect Sample Project then go to Test Execution module. You'll see the test results submitted to qTest Manager as Test Runs under a Test Suite naming Automation YYYY-MM-DD, as shown below.
Now we are going to schedule test execution for some specific test runs with the UFT agent and verify it only executes tests that match the scheduled test runs.
Schedule Test Execution for specific Test Runs
From qTest Manager, select the project qConnect Sample Project then click on Test Execution tab. Do the followings:
- Select the newly created test suite, in our example, it is Automation 2019-01-04.
- From the test run list on the right, select the first test run
- Click on MORE button, then select Schedule
On SCHEDULE AUTOMATION TEST EXECUTION dialog, enter the followings:
- Name: name of the schedule, e.g. Execute test with UFT Universal Agent
- Agent: select the UFT agent we created previously
- Click OK button to complete test execution scheduling for the selected test run.
Now go back to Automation Host UI. Click Poll Now button.
At this stage, the Automation Host does the followings:
- immediately polls to qTest Manager to load schedule jobs and
- execute the job execution for the test in UFT project that match the automation content of the scheduled test run
When the execution completes, click on View Log icon to view execution log.
A log screen will display that shows the last execution logs. Verify that the log reported only 1 test has been executed.
You have successfully scheduled test execution for specific test in your UFT project using Universal Agent, and have it report the test execution to qTest Manager.