Menu

Create Universal Agent from qTest Automation Host

Overview

This article provides instructions on how to create a Universal Agent in qTest Automation Host. We recommend using the Universal Agent as opposed to the legacy Shell Agent.

Create New Universal Agent

1. From the Automation Host home page, select the + Add button.

add-agent-btn.png

2. You will be presented with a New Agent dialog.

host-create-new-agent-dlg.png

3. Enter the information listed below for the new agent.

General Agent Information

universal-agent-general-info.png

  • Agent Name: name of the new agent
  • qTest Manager Project: select a qTest Manager project from which the agent is going to execute scheduled tests
  • Agent Type: Universal Agent

Pre-Execute Script

This section provide an editor for you to compose scripts to be executed when the Universal Agent is kicked-off.

pre-execute-script.png

Enter scripts you want Universal Agent to execute, one of common practices is:

  • Setup working directory for your automation project
  • Pull, checkout or clone source code of your automation project from source control to the working directory

Examples: pull source code of your automation project from git repository to your working directory. If the directory or the source code does not exist, create the directory and clone the source code into that directory. Below script is how you can archive it on Linux, Mac or Windows.

Linux/Mac

#!/bin/bash
if [ ! -d "/path/to/working/dir/my-project" ]
then
# move to working dir
cd "/path/to/working/dir"
# clone the repo to the working directory
git clone <repo-url>
else # the working project already exists
# move to working dir
cd /path/to/working/dir
# pull latest code
git pull --all
fi

Windows

if not exist "\path\to\working\dir\my-project" (
cd /d "\path\to\working\dir"
git clone <repo-url>
) else (
cd /d "\path\to\working\dir"
git pull --all
)

* For more information about git commands, check out the docs at: https://git-scm.com/docs

Execute Command

Executor

host-execute-command-executor.png

Executor specifies the execution environment, or program, that executes your commands. Possible values are:

  • shell: select this option if you want Universal Agent to execute your commands as shell scripts. Select this option if your host is running on Linux or Mac
  • batch: select this option if you want Universal Agent to execute your commands as batch scripts. Select this option if your host is running on Windows
  • node: select this option if you want your command to be executed as a NodeJS program
    • Note: starting from Automation Host 2.1.0, NodeJS is bundled into automation host package so you do NOT need to install NodeJS to the host machine in order to execute your command with selected node executor. However, you need to make sure the code you enter is compatible with that NodeJS version
  • python: select this option if you want your command to be executed as a Python program.
    • Note: this option is recommended for Automation Host running on Mac machine, as python 2.7 was pre-installed with MacOS
  • python3: select this option if you want your command to be executed as Python3 program. This option is recommended if the automation host is running on either Linux, Windows or Mac
    • Note: you must install python3 to your host machine for the Universal Agent to invoke it to execute your python scripts. You can download and install python3 from here: https://www.python.org/downloads

Working Directory

This field is optional. However, it is highly recommended to select the working directory where you want your execute command to execute.

Example: /path/to/working/dir/my-project

Execute Command

This is where you enter the commands to execute your test project. 

Example: configure execute commands to execute your test project using maven

  • Executor: shell
  • Working Directory: /path/to/working/dir/my-project
  • Execute Command:
    # execute test with maven
    mvn clean compile package test
    

host-execute-command-sample.png

Path to Results

If you are configuring the execute command to execute tests, which is the main use case of Universal Agent, Path to Results is where you specify path to the test results generated by your test project.

This optional field is used in combination of Result Parser (more detail later) to parse the results to the unified format that the Automation Host understands. Path to Results accepts one of the followings:

  • Path to your test result file. Example: /path/to/working/dir/postman-api-test/postman-result.json
  • The directory where all of your results are located. Examples:

host-path-to-results.png

Result Parser

This optional field specifies the parser that transforms the test results to an unified format. The output of the parser will then be obtained by the Automation Host to submit test result to qTest Manager as test run logs.

host-result-parser.png

Below are possible options for Result Parser:

  • JUnit for Java: select this parser to parse test result under JUnit format
  • Postman Json: select this parser to parse test result generated by Postman under Json format
  • Tosca JUnit: select this parser to parse test result generated by Tosca under JUnit format

* To learn more about test result parser, click here.

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 fields. Otherwise, you must do that yourself via Execute Command.

The screenshot below shows you how the new Universal Agent is configured.

host-create-universal-agent-final.png

Appendix

Pre-Execute Scripts Examples

This section provide examples to be used as pre-execute scripts. You can select any of the example in this section and it will be appended to the Pre-Execute Script editor. Screenshot below show how git clone example looks like when you click on it.

pre-execute-script-examples.png

Follow this article to learn how to use Pre-Execute Scripts examples.

Execute Command Examples 

This section provides examples to be used to execute your tests. Click on each specific command will append the detail of that command to the execute command editor. Below screenshot shows how these examples look like. Note that the detail of each command is specific to the selected executor.

execute-command-example.png

To learn more about Execute Command examples, follow this article.

Powered by Zendesk