Integrate Cucumber with Universal Agent

In this article, you will learn how to integrate Cucumber with the Universal Agent.

The sample source code of Cucumber project is located at


  1. Activate Automation Integration
  2. Install and Register the Automation Host
  3. Your machine needs to have git installed.
  4. You machine needs to have Java installed. The Java version should be the one compatible with what you use to run your Cucumber project
  5. This example use Maven to execute the tests. Make sure you install maven to the automation host machine
  6. Along with Maven, this example also uses maven-compiler-plugin and maven-surefire-plugin to execute tests and generate report. Refer to the IMPORTANT NOTES section to configure the pom.xml file when you integrate your actual Cucumber project with Universal Agent
  7. This article uses Selenium that opens Chrome browser, so make sure you also install Google Chrome to the machine where Automation Host is running

Create Cucumber Universal Agent

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

  3. The New Agent dialog will
  4. Enter the information below for the new agent.

General Agent Information


  • Agent Name: name of the agent, e.g. Cucumber 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

Enter the script below in the Pre-Execute Script editor, which is specific to the Operating System that the host is running.


if [ ! -d "/usr/local/var/cucumber-sample" ]
cd "/usr/local/var"
git clone
cd /usr/local/var/cucumber-sample
git pull --all


if not exist "D:\cucumber-sample" (
cd /d D:\
git clone
) else (
cd /d "D:\cucumber-sample"
git pull --all

Execute Command


  • Select node as the executor

Working Directory

  • If your host machine is running on Linux or Mac: enter /usr/local/var/cucumber-sample
  • If your host machine is running on Windows, enter D:\cucumber-sample

Execute Command

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

  • 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
  • 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 scenarios in our Cucumber project then create test run logs to qTest Manager as the execution result
  • if TESTCASES_AC variable has value, which are the automation contents of scheduled test runs, we will instruct Universal Agent to only execute scenarios that match those automation contents


  • make sure you install maven to your host machine for the command to be executed successfully by Universal Agent.
  • the execute command will need to specify full path to maven executable. You can execute the following command to find the Maven executable path from either Terminal (Linux/Mac) or Command Prompt (Windows), in bold.
    $ mvn -v
    Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
    Maven home: /usr/local/opt/apache-maven-3.5.4
    Java version: 10.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
    Default locale: en_US, platform encoding: UTF-8
    OS name: "mac os x", version: "10.14.2", arch: "x86_64", family: "mac"

Enter the code snippet below to the Execute Command editor dependent on the OS that the automation host is running.


Linux or Mac

Path to Results

Optional field. Enter the value below to specify the path to the test result generated by the Cucumber project

  • If your host machine is running on Linux or Mac: /usr/local/var/cucumber-sample/target/surefire-reports
  • If your host machine is running on Windows: D:\cucumber-sample\target\surefire-reports

Result Parser

Optional field. Select Cucumber JUnit as the Result Parser. Note: if you do not find the Cucumber JUnit parser in the Result Parser list, follow below steps to make it available to Universal Agent:

  • Save the Cucumber Universal Agent. You'll be return back to Automation Host dashboard
  • Download Cucumber JUnit parser HERE
  • Access qTest Launch and follow this article to upload the Parser to qTest Launch
  • Go back to Automation Host UI, refresh the page for it to load the new parsers
  • Select to edit Cucumber Universal Agent and you'll find the Cucumber JUnit parser from the Result Parser list


  • 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 how the new Cucumber Universal Agent is configured, on Mac.


Select SAVE to finish creating the agent. The agent will be available the next time the host machine polls to qTest Launch.

Execute Cucumber Universal Agent

  1. Access the host machine where the Cucumber Universal Agent was created.
  2. Locate the agent in the Agents list and select the Run now button.
  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.cucumber-universal-agent-execution-first-time.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.


Now we are going to schedule test execution for some specific test runs with the Cucumber 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-03.
  2. From the test run list on the right, select the first three (3) test runs
  3. Click on MORE button, then select Schedule


On SCHEDULE AUTOMATION TEST EXECUTION dialog, enter the followings:

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


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


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 three tests/scenarios in Cucumber project that match the automation content of the three scheduled test runs

When the execution completes, click on View Log icon to view execution log.


A log screen will display that shows the last execution logs. Verify that the log reported only three (3) tests have been executed.


You have successfully scheduled test execution for specific tests in your Cucumber project using Universal Agent, and have it report the test execution to qTest Manager.


When integrating your actual Cucumber project with Universal Agent and you choose to execute it with Maven (highly recommended), make sure to add the plugin maven-sure-fire-plugins and maven-compiler-plugin to your pom.xml file, as shown below.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""
    <!-- End configuration -->

You can also refer to the pom.xml file used in our sample here: 

Powered by Zendesk