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, SauceLabs 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.




Setting up the Agent


Prerequisites for running the Testsigma agent on a machine are Java Runtime Environment(JRE) and Apache Tomcat Server.


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 3.


(I)       Installing Java Runtime Environment

(II)      Set the Environment variables for Java

(III)     Setting up Apache Tomcat server

(IV)     Configure device drivers for Testsigma agent

(V)      Setting up Testsigma agent


(I) Installing Java Runtime Environment

To install Java Runtime Environment(JRE), you can download the latest version of JRE executable from Oracle here.

The executable file can be run on the system and the 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



(II) Set the 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?



(III) Setting up Apache Tomcat server


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:


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.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 give 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.

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.



(IV) Configure device drivers for Testsigma Agent


Now that we have confirmed that Apache Tomcat server is running successfully, we can move on to configuring 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



(V) Setting up the Testsigma Agent


We have placed the required driver files for Testsigma agent in the filesystem and now we can move onto setting up the 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.


1. We need to copy the ‘agent.war’ file to the folder named ‘webapps’ inside the Apache Tomcat working directory. 

2. 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.

3. 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:



4. 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.


5. 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.


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


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


8. Goto 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.