Menu

Configure TestNG Agent

PREREQUISITES:

  1. Activate Automation Integration
  2. Install and Register the Automation Host
  3. Install the TestNG Framework Plugin

The Agent Configuration pop-up includes 3 steps:

  1. General Information
  2. Test Scripts
  3. Execution

General Information

  • Agent name: Define the agent's name.  This is the agent name that will be selected in qTest Manager Test Execution when scheduling Test Runs
  • qTest project: It lists out all qTest projects which are accessible using the agent's credentials. Select one of the projects in your qTest application. An agent can work with only one qTest project.
  • Automation framework: The frameworks whose plugins have been installed will be listed out. Select your desired framework.

Test Scripts

  • Directory: Specify the home directory of your TestNG source code.
    • Example: D:\qTestAutomation\TestingDemo\TestNG_Sample\TestNGHelloWord
  • Scripting libs: Provide the paths to the dependencies (files or folders). You can input more than one paths, separated by a comma. If all of your jar libraries under a folder, you can simply put its path here.
    • Example: D:\qTestAutomation\TestingDemo\TestNG_Sample\TestNGHelloWord\libs
  • Include: You can use ANT Style Pattern Matcher to define the patterns of files which will be scan for tests. Use comma as separators between the patterns. It is the required information so that the agent can scan your coding directory for tests and automatically create Test Cases in qTest.
  • Exclude: You can optionally define patterns to exclude files from the scanning.
  • Scan jar files: If you select this checkbox, the agent will also scan files in jar files.

HINT: ANT Style Pattern Matcher uses the following rules:

  • ? matches one character.
  • * matches zero or more characters.
  • ** matches zero or more 'directories' in a path.

Execution

The TestNG Agent supports 3 execution modes to build and run your test projects (Command, Ant, Maven). Based on your selected mode, you will need to provide different information.

Execution w/ Command

  • Executable home: Specify the path to the home directory of your program development environment. For example, if you are using JDK, input the folder where the JDK is installed.
    • Example: C:\Program Files\Java\jdk1.7.0_21
  • Command: the command to execute your scripts.
    • Example: In case you are using Java, input java.
  • TestNG test file: In case your test's configurations are defined in a TestNG XML file, input the file name here. If you are passing parameters to your methods, this file must be defined. NOTE: This file should be located under the home directory of your source code and you can only input one file. You can simply input its relative path in this field.
    • Example: sample.xml
  • Command arguments: You will need to provide the target directory where all built outputs are located. Provide any needed arguments.
    • Example: -cp D:\qTestAutomation\TestingDemo\TestNG_Sample\TestNGHelloWord\target\*

IMPORTANT:

  • While the agent is executing your tests, it is recommended that you do not modify your TestNG XML file. The changes may lost after the execution is done.
  • The agent will use the above information to generate a full command to execute your scripts.

Execution w/ Ant

The automation agents support using Ant to build and run your coding projects.

  • Executable home: Input the path where Ant is installed.
    • Example: D:\apache-ant-1.9.2
  • Target: Specify which target will be executed. This is the name of the target which has been defined in your build file.
    • Example: all
  • Build file: Provide the path to your build file in which the above target is defined. ]This file is located under the home directory of your test source code. The above target is defined in this file as the image below.
    • Example: build.xml
  • TestNG test file: In case your test's configurations are defined in a TestNG XML file, input the file name here. If you are passing parameters to your methods, this file must be defined. NOTE: This file should be located under the home directory of your source code and is defined in build.xml as the image below. You can only input one file. 
    • Example: sample.xml
  • Command arguments: Provide any additional arguments to execute the target.

IMPORTANT:

  • While the agent is executing your tests, it is recommended that you do not modify your TestNG XML file. The change may lost after the execution is done.


Execution w/ Maven

The automation agents support using Maven to build and run your coding projects.

  • Executable home: Input the path to your Maven directory. This is where Maven is located.
    • Example: D:\apache-maven-3.1.0
  • Goal:
    • Example: test
  • POM file: Provide the path to your POM file, which is located under the home directory of your test source code. Please note that this is the relative path under your scripting directory.
    • Example: pom.xml
  • TestNG test file: In case you have your tests' configuration defined in a TestNG XML file, you can put it here. If you are passing parameters to your methods, you will need to define these in this file. Please be noted that this is the relative path under your scripting directory and you can put only one file. This file needs to be defined in the above POM file. See the samples below for more details.
    • Example: sample.xml
  • Command arguments: Provide any additional arguments to execute the target.

IMPORTANT:

  • While the agent is executing your tests, it is recommended that you do not modify your TestNG XML file. The change may lost after the execution is done.


Subscribe To Our Blog
Powered by Zendesk