Menu

Integrate JBehave with Universal Agent

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

The sample source code of JBehave project is located at https://github.com/QASymphony/jbehave-agent-sample

Create JBehave Universal Agent

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

  3. The New Agent dialog will display.new-agent-dlg.png

  4. Enter the information below for the new agent.

General Agent Information

universal-agent-general-info.png

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

Linux/Mac

#!/bin/bash
if [ ! -d "/usr/local/var/jbehave-agent-sample" ]
then
cd "/usr/local/var"
git clone https://github.com/QASymphony/jbehave-agent-sample
else
cd /usr/local/var/jbehave-agent-sample
git pull --all
fi

Windows

if not exist "D:\jbehave-agent-sample" (
cd /d D:\
git clone https://github.com/QASymphony/jbehave-agent-sample
) else (
cd /d "D:\jbehave-agent-sample"
git pull --all
)

Execute Command

Executor

  • If your host machine is running on Linux or Mac, select shell as the executor.
  • If your host machine is running on Windows, select batch as the executor.

Working Directory

  • If your host machine is running on Linux or Mac: enter /usr/local/var/jbehave-agent-sample/org.qas.jbehave.example
  • If your host machine is running on Windows, enter D:\jbehave-agent-sample\org.qas.jbehave.example

Execute Command

You will configure the Execute Command to execute our sample JBehave project with maven.
Note: make sure you install maven to your host machine for the command to be executed successfully by Universal Agent.

Enter the command below to Execute Command editor.

mvn clean compile integration-test package

Path to Results

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

  • If your host machine is running on Linux or Mac: /usr/local/var/jbehave-agent-sample/org.qas.jbehave.example/target/failsafe-reports/TEST-org.qas.jbehave.example.stories.ExampleStories.xml
  • If your host machine is running on Windows: D:\jbehave-agent-sample\org.qas.jbehave.example\target\failsafe-reports\TEST-org.qas.jbehave.example.stories.ExampleStories.xml

Result Parser

Optional field. Select JUnit for Java as the Result Parser.

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

The screenshot below shows how the new JBehave Universal Agent is configured, on Mac.

jbehave-universal-agent.png

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

Execute JBehave Universal Agent

  1. Access the host machine where the JBehave Universal Agent was created.
  2. Locate the agent in the Agents list and select the Run now button.
    run-jbehave-now.png
  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.run-jbehave.png

Now you can access qTest Manager and schedule test execution for the newly created test runs with JBehave Universal Agent.

 

Subscribe To Our Blog
Powered by Zendesk