Create Universal Agent from qTest Automation Host

The Automation Host UI is disabled. You can manually activate the Automation Host UI during installation to use it either on the local host or on the local network. However, all Automation Host functions are now available in Launch. We recommend that you access all the tools you need from Launch as the most secure option.

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

Create a New Universal Agent

  1. On the Automation Host home page, click the Add button in the Agents section to add a new agent.

    For information on accessing qTest Automation Host, refer to Access qTest Automation Host for Windows, Access qTest Automation Host for Mac, or Access qTest Automation Host for Linux.
  2. You will be presented with a New Agent dialog.

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

    • 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 provides an editor for you to compose scripts to be executed when the Universal Agent is kicked-off.

Enter scripts you want the Universal Agent to execute. One common practice is to do the following:

  • Set up a working directory for your automation project

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

Example

  • 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 and Mac

Copy
#!/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

Copy
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

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

  • shell: Select this option if you want the 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 Node.js program.

    Starting from Automation Host 2.1.0, Node.js is bundled into the Automation Host package so you do NOT need to install Node.js to the host machine in order to execute your command with the selected node executor. However, you do need to make sure that the code you enter is compatible with that Node.js version.
  • python: Select this option if you want your command to be executed as a Python program.

    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 Python 3 program. This option is recommended if the Automation Host is running on either Linux, Windows, or Mac.

    You must install Python 3 to your host machine for the Universal Agent to invoke it to execute your Python scripts. You can download and install Python 3 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

Here, 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:

    Copy
    # execute test with maven
    mvn clean compile package test

Path to Results

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

This optional field is used in combination with the 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.

    • Example:

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.

Below are possible options for Result Parser:

  • JUnit for Java: Select this parser to parse test results under JUnit format.

  • Postman Json: Select this parser to parse test results generated by Postman under JSON format.

  • Tosca JUnit: Select this parser to parse test results generated by Tosca under JUnit format.

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

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 the Execute Command.

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

Appendix

Pre-Execute Scripts Examples

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

Refer to Universal Agent Code Snippets for information on using Pre-Execute Scripts examples.

Execute Command Examples 

This section provides examples for test execution. Selecting 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.

NEXT STEPS