Create Universal Agent in qTest Launch

This article provides instructions on how to create a Universal Agent in qTest Launch 1.3 and beyond.

We recommend using the Universal Agent as opposed to the legacy Shell Agent.

Create a New Universal Agent

  1. From Launch, open the host machine where you want to create the new agent and then select the + New Agent button.

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

  3. Enter the following information 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 that will execute when the Universal Agent is kicked-off.

Enter scripts you want the Universal Agent to execute. One common practice is outlined below:

  • Setup a working directory for your automation project.

  • Pull, checkout, or clone the source code of your automation project from the 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 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

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. This option is only available 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. This option is only available 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 Automation Host package so you do NOT need to install Node.js 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 Node.js version.
  • python: Select this option if you want your command to be executed as a python program.

    If you are on Mac, python 2.7 was pre-installed already with MacOS. Otherwise, you need to install Python to the host machine in order for Automation Host to invoked it to execute your Python scripts. You can download and install Python here: https://www.python.org/downloads
  • python3: Select this option if you want your command to be executed as a Python 3 program.

    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 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 command 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 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 could understand. 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

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 used by the Automation Host to submit test result to qTest Manager.

Below are possible options for Result Parser:

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

  • Postman Json: Select this parser to parse Postman test results.

  • Tosca JUnit: Select this parser to parse Tosca test results.

To learn more about test result parser, refer to Develop a Custom Test Result Parser for Universal Agent.
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 via Execute Command.

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

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.

Refer to Pre-Execute Scripts Examples for information on using 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 screenshots show how these examples look like. Note that the detail of each command is specific to the selected executor.

To learn more about Execute Command Examples, refer to Execute Command Examples.