Setting up Testsigma Agent on your local Windows/Mac/Linux machine


Introduction

Once you have created a test case containing a number of test steps for execution, we can move onto setting up an execution environment.

We may choose any of the available execution models such as Testsigma Lab, Hybrid, Sauce Labs or BrowserStack.


For Hybrid Model, we need to configure a local machine to execute the tests. We can do that by setting up and executing the Testsigma Agent on the machine. The Agent will do the required configuration, avoid the hassle of numerous configuration for end-users and allow us to concentrate on managing the tests alone.


We assume that you have already created a Hybrid Execution on Testsigma website before configuring your local machine. If not, please refer to this article for a detailed guide on creating a Hybrid Execution - How to Create a Hybrid Execution for running Tests on Local Machine?

After creating an Execution, come back to this article for setting up the local machine for Hybrid Execution.


Below article explains the process of setting up your local machine for Hybrid Execution by configuring the Testsigma Agent Application.


NOTE: The below given article content for configuring the agent has been deprecated now. This will work but we have introduced a shorter and easier way for Testsigma Agent setup. Please follow this new article if you are trying to setup the Testsigma Agent for the first time - Quick setup guide - Setup TestSigma Agent on your device for Hybrid Test Execution(WIndows/Mac/Linux)


NOTE: If you have previously configured your agent and you are trying to migrate to new Testsigma Agent(with auto-update), please follow this article to know about the upgrade process - How to upgrade the Testsigma Agent to the newest auto-update version(One time setup)?


Prerequisites


1. Java Run-time Environment(JRE) or Java Development Environment(JDK)

If you are not sure whether JRE is installed or not, please go to Command prompt(Windows) or Terminal(Mac/Linux), type "java -version" and press Enter.

  • If Java is installed and the Environment Variables are set, you will see the details of installed java version and you can skip to step (II) below.
  • If java is installed but Environment Variables are not set, follow the below steps.


To install Java Run-time Environment(JRE), you can download the latest version of JRE executable from Oracle here. The executable installer will take care of the installation.


Note: JRE version 7 or 8 is recommended to avoid compatibility issues.


For a detailed guide on installation, please refer to the official documentation given below:

Windows | Linux | Mac


2. Environment variables for Java

Once the JRE is downloaded and installed, you need to

  • set the JAVA_HOME environment variable to the directory where java is installed(JRE or JDK folder)
  • set the Path environment variable to the folder containing the java executable(bin folder inside JRE or JDK folder).

Here's a detailed article on setting up the Environment variables for Java in Windows/Mac/Linux - How do I set or change the PATH system variable?



Setting up the Agent


(I) Add device drivers for Testsigma agent

(II) Starting Apache Tomcat Server

(III) Deploying Testsigma agent

(IV) Registering Testsigma Agent


(I) Add device drivers for Testsigma Agent


Now that we have confirmed that Java is installed and working, we can move on to adding the drivers for the Testsigma agent and then configuring the agent itself.


1. Download the zip file for Testsigma Agent Driver files from the following link. Download the zip file specific to your OS below:


Windows 32bit | 64bit

Mac 32bit | 64bit

Linux 32bit | 64bit


2. Create a folder named ‘drivers’ outside the Apache Tomcat working directory (Apache working directory and drivers directory should be in the same parent directory) and extract the contents of the downloaded zip there. The resulting folder structure should be similar to the one given below:


For Windows

For Mac/Linux




(II) Starting Apache Tomcat Server


Testsigma Agent is essentially a Web Application that manages the connection between Testsigma Server and Local PC/Mac where the Tests are to be executed. Since it is a web application, we will need to host it on the local PC/Mac to use it. Apache Tomcat server is an open source software managed by Apache that is used to set up a web server. You can download it for free from Apache Tomcat website here.

Apache Tomcat Download page.



For Windows

1. Download the zip or tar.gz file specific to your OS architecture(32 bit or 64 bit) and extract its contents to a specific directory.


Let us assume you have downloaded the file ‘apache-tomcat-xxxx.zip’(xxx replaces the version name) and extracted the folder named ‘apache-tomcat-xxxx' inside the zip file to a specific directory named Testsigma inside E: drive.


Thus, the absolute path to the folder where Apache Tomcat files are located is ‘E:\Testsigma\apache-tomcat-xxxx’ and it is called Apache Tomcat working directory. The contents of Apache Tomcat working directory is shown below:



2.Go to ‘bin’ directory inside the Apache Tomcat working directory. You would see 2 files named ‘startup.bat’ and ‘shutdown.bat’ there along with many other files.


3. Open a ‘Command Prompt(cmd)’ window and navigate to the above-specified bin directory i.e. ‘E:\Testsigma\apache-tomcat-xxxx\bin’ using the cd command.




4. We need to run the ‘startup.bat’ file to start the server. Type ‘startup.bat’ and press ‘Enter’ key. Another window will open up and the Apache server will start running. Keep both the command prompt windows open and wait for the message “server startup in X ms” in the newly opened window.



5. After that, open your web browser ex: Chrome, firefox, IE etc and go to address - http://localhost:8080/


6. Apache server webpage would load up as given below:



This confirms that Apache server is running successfully.


For Mac / Linux

1. Download the zip or tar.gz file specific to your OS architecture(32 bit or 64 bit) and extract its contents to a specific directory. 


Let us assume you have downloaded the file ‘apache-tomcat-xxxx.zip’(xxxx replaces the version name) and extracted the folder inside the zip file named ‘apache-tomcat-xxxx’ to a folder named 'Testsigma' in the 'Documents' directory. 


Thus, the absolute path to the folder where Apache Tomcat files are located is ‘~/Documents/Testsigma/apache-tomcat-xxxx’ and it is called Apache Tomcat working directory. The contents of Apache Tomcat working directory is shown below:


Note: The latest stable version as of writing this article is ‘apache tomcat 8.5.24’.

2. Go to ‘bin’ directory inside the Apache Tomcat working directory. You would see 2 files named ‘startup.sh’ and ‘shutdown.sh’ there along with many other files.



3. Open a ‘Terminal’ window and navigate to the above-specified bin directory i.e. ‘~/Documents/Testsigma/apache-tomcat-xxxx/bin’ using the cd command.



4. We need to run the ‘startup.sh’ file to start the server. Type ‘./startup.sh’ and press ‘Enter’ key. Another window will open up and the Apache server will start running. Keep both the Terminal windows open and wait for the message “server startup in X ms” in the newly opened window.


5. After that, open your web browser ex: Google Chrome, Safari etc and go to address

http://localhost:8080/



6. Apache server webpage would load up as shown above. This confirms that Apache server is running successfully.


(III) Deploying Testsigma Agent


You can download the Testsigma agent file from here - Testsigma Agent


It is essentially a zip archive file containing a file named agent.war that houses the Testsigma Agent Web Application.


Note: It is advised to stop the Apache Tomcat server before adding the agent file to the Apache Tomcat working directory. You can stop the server by running the shutdown script located in the bin directory in a manner similar to running the startup script. Run the shutdown.bat file for Windows and shutdown.sh file for Mac/Linux to stop the server.


For starting the Testsigma Agent, we need to - "place the Agent.war file inside WebApps folder inside apache-tomcat-x.x.xx".

Delete the existing files in that folder and copy the Agent.war file. At the end, there should be only the Agent.war file and agent folder(optional) in the WebApps folder.


For windows



Once that is copied, we can start the server again by running the 'startup.bat' file for Windows and 'startup.sh' file for Mac / Linux. The Apache server is hosting the Testsigma Agent web application which was contained in the agent.war file.


(IV) Registering the Agent


1. Open a web browser window and go to URL http://localhost:8080/agent to open the web application. If everything went well, you would get a webpage similar to the one given below:



2. Click on the register agent link and enter the following details for registering and authorizing the agent.

  • Server URL: Testsigma Application URL (https://app.testsigma.com). No modification required unless you are using Testsigma private-cloud setup.
  • Username: Username of your Testsigma Account
  • Password: Password for your Testsigma Account

Click on the Register button to register the Agent. We will get a notification saying that the Agent has been registered successfully.


3. After successful registration, click on the Executions link on the left navigation menu to go to the Executions page. There won't be any Execution listed there if we have not started or scheduled any Hybrid Executions.



However, your local machine is now configured and ready to accept communication from Testsigma App Website.


4. Now, go to the Testsigma website and start execution of the recently created Hybrid Execution.


5. After starting the execution in Testsigma App on the website, come back to the Testsigma Agent page on the local machine. 


6. Go to Register page and register once again if prompted for. Click on the Executions link. Now you will be able to see the Execution on the Executions page.


You have successfully configured your machine to run Tests locally. The Agent server will wait for the request from Testsigma Website App and the tests would start running in a few moments on our local machine.


Final Steps


Once the tests have been completed, you may close the web browser and shut down the Agent server by running the shutdown script located in the bin directory in a manner similar to running the startup script. Run the shutdown.bat file for Windows and shutdown.sh file for Mac/Linux to stop the server.