Follow

QMetry Selenium Integration

Introduction

QMetry integrates with Selenium to help Quality Assurance teams coordinate automated and manual tests to ensure full reporting, improved communication, and increased efficiency between automation and manual testing teams.

QMetry web services enables seamless integration with Selenium. Testers can kick off their test automation scripts directly from QMetry. All test results will be automatically imported back into QMetry to help management use QMetry’s enterprise level reporting to track progress of testing and requirement coverage. Testers may run the test scripts right away or schedule them for a time in the future through a simple and user friendly interface.

About This Guide

This guide helps understanding the agent and launcher concepts in QMetry.  The guide also provides all links to download the agent and launcher along with detailed steps to configure them for successful integration of QMetry with Selenium.  Also included are examples in the video which would help to understand the integration better.

Understanding Agent & Launcher Concept

QMetry application uses QMetry Agent and QMetry Launcher plugins for execution of automation selenium scripts. QMetry Agent and Launcher executes tests invoking test scripts at hosting machine and reports test results to QMetry. User can define Agent alias and add tasks for QMetry Agent. On activation the Agent requests for task from QMetry and stores test suite execution schedules in Agent Pool. Agent automatically invokes Launcher providing all the necessary testsuite information to launch the execution. Launcher executes the testsuites and performs actions defined in the script. After execution launcher updates the results back in QMetry and Agent updates status of schedule.

Role of The QMetry Agent

Agent picks the testsuites schedules from QMetry, invokes QMetry launcher and provides them to QMetry Launcher for execution.

Role of The QMetry Launcher

Launcher executes the testsuites and performs actions defined in the script and updates the results back to QMetry application.

System Requirements

  • Operating System: Windows 7 or higher, Linux (RHEL 6.5/CentOS 6.5 or higher)
  • Java Runtime Environment (JRE) 1.8 or later.
  • Administrator privilege to install QMetry Test Automation Agent as Windows Service
  • Root privilege to run QMetry Test Automation Agent as Unix Daemon
  • Port 4444 should be available for Selenium Launcher. QMetry Selenium Launcher will try to launch Selenium Server on its default port (4444) to launch selenium scripts.

Prerequisites for Integrating Selenium with QMetry

Step 1 : Download QMetry Agent

  • Download QMetryAgent.zip. Extract QMetryAgent.zip on target machine. We assume that you will extract it on C:\. The directory structure would be like “C:\QMetryAgent\…”
Note: We are assuming that you are using “C:\” as your working directory for any subsequent task.

Step 2 : Download QMetry Launchers

  • Download QMetryLaunchers.zip. Extract QMetryLaunchers.zip file on target machine. So now you are having directory structure like “C:\QMetryLaunchers\…”
Note : QMetry Agent and QMetry Launcher should be on same target machine.

Step 3 : Download Selenium Standalone Server

  • Download Selenium Standalone Server jar file. (latest is 2.52.0 while authoring the document)
  • Save the jar in the working directory so that we can have jar file at “C:\selenium-server-standalone-2.52.0.jar”

Step 4 : Download Demo project

  • Download demo project zip file
  • Extract the file and place it in working directory so that we can have "C:\bin\com" path

Setting up QMetry Agent

Step 1 : Creating Agent in QMetry

  • Log into QMetry Application. Go to Admin > Agent
  • Create an Agent by clicking the Add Agent button
  • Mention desired Agent Alias name and click on Save. Note : Alias should be named in a way that it becomes easy to identify the machine where Agent/Launcher is kept. Like Alias could be “Selenium Win 8 FF37″ 
  • Save button triggers a new popup “Agent configuration”, click on “QMetry Agent Configuration” link.
  • It should download QMetryAgent.properties file.
  • Copy the QMetryAgent.properties file under QMetryAgent\bin directory i.e. C:\QMetryAgent\bin. Replace if there exists same file.

Step 2 : Setting up mandatory parameters in the Agent configuration file

  • Edit QMetryAgent.properties file using text editor. Remember : QMetryAgent.properties does not support back slashes, either convert them to forward slash (for example, C:/Program Files/Java/jdk1.8.0_73) or escape them with additional back slash (for example, C:\\Program Files\\Java\\jdk1.8.0_73).
  • Interval: Interval is used to define the frequency at which agent check for pending schedule from QMetry. Interval is set in seconds, by default the interval is set as 180 seconds.
  • TESTSCRIPTEXECUTABLE: Mention the script executor for the scripts. If your wrapper script is in Java, then set this environment variable with value of Java executable location like TESTSCRIPTEXECUTABLE = “C:/Program Files (x86)/Java/jre1.8.0_73/bin/java”.You can set the value as a “java” only if your system have JRE path configured in environment variables. So, the parameter for becomes TESTSCRIPTEXECUTABLE = java
  • TESTSCRIPTWRAPPER: TESTSCRIPTWRAPPER contains Test Script Wrapper script names with full path. As example we are using qmetry-selenium-launcher (i.e. com.qmetry.launcher.QMetrySeleniumLauncher). To use qmetry-selenium-launcher, following dependencies need to be set:
    1. QMetryLaunchers/QMetryLaunchers.jar
    2. QMetryLaunchers/
    3. QMetryAgent/bin/QMetryAgent.jar
    4. ../path-to-selenium-library/selenium-server-standalone-x.xx.x.jar
    5. Define path to binaries (“.class” files in case of Java) of your test cases. Remember : Set path to the directory from where whole package hierarchy starts. Do not set different paths of each and every binary files. For example, if a particular test case class is in package com.test.demo then set the path of directory as “C:/bin” if it is in C:/bin/com/test/demo.
    6. If your Selenium Test Framework has dependencies on other JAR files, then please add those too in this property.
    7. The TESTSCRIPTWRAPPER = -classpath C:/QMetryLaunchers/QMetryLaunchers.jar;C:/QMetryLaunchers;C:/QMetryAgent/bin/QMetryAgent.jar;C:/bin;C:/selenium-server-standalone-2.52.0.jar com.qmetry.launcher.QMetrySeleniumLauncher

Setting up QMetry Launcher

Step 1 : Setting up mandatory parameters in the Launcher configuration file

  • Open QMetryConfig.properties file located at “C:\QMetryLaunchers\” using text editor.
  • QMetryURL: Set to the url of the QMetry instance, like QMetryURL= http://test.qmetry.com/qmetry
  • QMetryUsername: QMetry Username (Which would be used for Automation)
  • QMetryPassword: QMetry Password. Remember : The password should be in base64 encoded string. You can use https://www.base64encode.org/ to encode the password in base64 format.

Step 2 : Configure proxy settings

If QMetry Automation Agent needs to communicate with QMetry server, using HTTP Proxy, then make sure that all Proxy related values mentioned below are set according to the environment.
  • setProxy: If the flag is set as “true”, this would enable proxy settings. Otherwise, the proxy settings will be ignored for the flag set as “false”.
  • ProxyHost: Set Domain Name or IP Address of your HTTP Proxy Server.
  • ProxyPort: Set the Port on which the HTTP Proxy Server is listening.
  • ProxyUser: Mention Proxy Username in case of authenticated proxy.
  • ProxyPassword: Mention Proxy Password, in case of authenticated proxy.

Step 3 : Configure additional parameters

  • JavaFramework = Set the JAVA Framework as TestNG or JUnit (TestNG/JUnit)
  • There are several other parameters that can be configured. Details of every parameter is available in QMetryConfig.properties file

Registering and Starting Agent

Start Agent On Windows OS

  • To start agent execute StartQmetryAgent.bat from C:\QMetryAgent\bin.
  • To install QMetry Agent as a windows service, follow the following steps:
    • Remember : One must be having administrative privileges to run this file.
    • For windows 32 bit platform, to Install QMetry agent as a service, run the InstallQmetryAgent.bat file from C:\QMetryAgent\bin
    • For windows 64 bit platform, to install QMetry agent as a service, run the InstallQmetryAgent_x64support.bat file from C:\QMetryAgent\bin

Start Agent on Linux OS

  • Remember : One must have root privileges to start QMetry Agent as Unix Daemon.
  • To start agent execute QmetryAgent.sh from QMetryAgent\bin.

Verify Agent Status

  • If QMetry Agent is successfully configured and started, its status would be “Active” on Admin >Agent screen in QMetry application along with the mac address of the machine from where it’s executed. This mac address would be used by QMetry to identify the machine and agent details.
  • Also the UID would be auto generated in QMetryAgent.properties file.

Configure & Execute Selenium Test Cases in QMetry

  • In QMetry, go to the Test Cases module
  • Create a Test Case and specify your Selenium Test Class under the “Test Script Name” field. Like com.demo.selenium.BrowseQmetryWebsiteClass” as mentioned in our example below.
  • Go to the Test Suites module
  • Create a Test Suite and link the Test Case created above, Select a Platform and link it with the Test Suite
  • Open Test Suite Detail window.
  • In detail window, go to Linked Platform(s) section and click on Agent icon for particular platform.
  • Select an Agent alias on which you want to execute your Selenium Test Case
  • Select the build from the drop down (mandatory for Automation).
  • Click the Run Now button to run the Selenium Test Case immediately, or else, select the Date and Time to schedule the execution on future date.
  • After execution is complete, open the execution screen and verify the status of the Testsuite and check if test logs (if any) are attached.

Debugging most common issues

  • QMetry Agent Log file should to referred to debug any errors during execution. The agent logs are available at QMetryAgent\bin in QMetryAgentLogs folders.
  • Incase Java version in your system, you might get an exception “Unsupported major.minor version 51.0″ in the log file. It shows that the jar file or class file that is being executed requires JRE 1.8 or higher.

Example

The Demo project extract has a folder named “com” which has BrowseQmetryWebsiteClass.classand BrowseQmetryWebsiteClass.java files which could be used as example. TheBrowseQmetryWebsiteClass script executes the following steps:
  1. Open the Firefox and browse www.google.com
  2. Searches for keyword “QMetry”
  3. Browse QMetry Website.
  4. Closes the browser.
Here are the steps to use the above example :
  1. QMetry Agent and QMetry Launcher should be already be set up following the steps above.
  2. Set Test script name as “com.demo.selenium.BrowseQmetryWebsiteClass”. Follow steps in section “Configure & Execute selenium test cases in QMetry” above.
  3. The TESTSCRIPTWRAPPER parameter in QMetryAgent.properties should have path set to location pointing to com.demo.selenium. Example : C:/bin/ ; this should be already present if  “Setting up mandatory parameters in the Agent configuration file” steps are followed.
  4. Start Agent and launch execution from testsuite.

Reference Video

Here is the video which demonstrates QMetry Integration with Selenium.

Support

If after reading through this document you need help with integration please contact support through our support portal.
 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk