Menu

Integrate UFT with Universal Agent

In this article you will learn how to integrate UFT tests with the Universal Agent.

Prerequisites

  1. UFT 14.03 or higher
  2. Activate Automation Integration
  3. Install and Register the Automation Host
  4. 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

Demo Video

Click HERE to watch demo video.

Create UFT Universal Agent

  1. From Launch, open the host machine where you want to create the new agent.
  2. Select the + New Agent button.
    launch-create-agent.png

  3. The New Agent dialog will display.new-agent-dlg.png
  4. Enter the information below for the new agent.

General Agent Information

universal-agent-general-info.png

  • 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

Pre-Execute Script

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
)

Execute Command

Executor

  • Select node as the executor.

Working Directory

  • Enter the directory where UFT script(s) are located, e.g. C:\test-projects\uft-sample-14.03

Execute Command

We are going to create a script written in NodeJS to:

  1. scan all the sub folders under Working Directory for .usr scripts and store it in an array
  2. 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
  3. 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
  4. 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

Result Parser

  • Select Unified Functional Testing (UFT) as the Result Parser.

IMPORTANT NOTE

  • 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.

configUFT.PNG

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

  1. Access the host machine where the UFT Universal Agent was created.
  2. Locate the agent in the Agents list and select the Run now button.
    run-now.png
  3. The Universal Agent execution dialog will display.
  4. 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. results.png

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.qTest.png

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:

  1. Select the newly created test suite, in our example, it is Automation 2019-01-04.
  2. From the test run list on the right, select the first test run
  3. Click on MORE button, then select Schedule

Schedule.png

 

On SCHEDULE AUTOMATION TEST EXECUTION dialog, enter the followings:

  1. Name: name of the schedule, e.g. Execute test with UFT Universal Agent
  2. Agent: select the UFT agent we created previously
  3. Click OK button to complete test execution scheduling for the selected test run.

Schedule_2.png

Now go back to Automation Host UI. Click Poll Now button.

poll-now.png

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.

view-log-icon.png

A log screen will display that shows the last execution logs. Verify that the log reported only 1 test has been executed.

Result.png

 

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.

 

 

Powered by Zendesk