Header

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

What is Selenium Grid?

Selenium Grid is a part of the Selenium Suite that is specialized to run multiple tests across different browsers, operating systems, and machines simultaneously.

Following are some of the salient features of Selenium Grid:

  • Execute test script on multiple machines at the same time.

  • Execute tests on different machines with different browsers

  • Execute tests on the same browser but with different versions

  • Save test execution time and effort

  • Has a Hub-node architecture, where Hub works as a central point that controls the nodes, and the nodes are the actual machines on which tests are executed.

How to work with Selenium Grid using Qualitia Offline Package?

In Selenium Grid, the hub is a computer, which is the central point where the tests from the Qualitia offline package are loaded. The Hub acts as the central server that controls the network of Test machines, also referred as Nodes. One Selenium Grid has only one Hub, which is the master of the network that controls all the nodes.
When a test with selected Desired Capabilities options is passed to the Hub, the Hub searches for the node that matches with options. For example, if you have defined the Desired Capabilities options to run a test on Windows 10 operating system using Chrome version XXX, the Hub will try to find a machine in the Grid that matches the criteria and runs the test on it. The Hub shows an error if no machine matches the criteria. A node, which is referred to as a Test Machine, opts to connect with the Hub. The Hub runs the tests on the test machines. A Grid network can have multiple nodes. Each node can have different platforms, that is operating systems and browsers. It is not necessary for the node to have the same platform as that of the Hub.

To set up a Grid network, first you must create a Hub and then connect (register) nodes to the Hub.

Building a Selenium Grid for Qualitia Mobile Testing


Mobile Test Automation has gained significant importance in recent times. Almost all the web applications are highly active these days and it is important to test how the applications work across devices. This is true for mobile native applications as well. At the same time, a huge number of devices and custom operating system versions have been introduced. This has made running tests manually over multiple devices difficult, even if the tests are automated.
This section guides on how you can use Appium along with Selenium Grid for Qualitia test case execution on multiple mobile devices.

Configuring the Hub


Perform the following steps to configure the hub:

  1. Download the Selenium Standalone Server from http://docs.seleniumhq.org/download/ Start the command prompt and navigate to the folder where you placed the Selenium server jar file.

  2. Execute the following command: java –jar selenium-server-standalone-X.XX.jar –role hub, where selenium-server-standalone-3.6.0.jar is the name of the downloaded .jar file


This starts the selenium grid server in your local ip with the default port of 4444. After you see this message, the Selenium Grid hub is up and running.
Open your browser and hit the following URL: http://<your ip>:4444/grid/console. You can now navigate to Grid Console:

Configuring the Appium Nodes

In this example, we have used two devices, Samsung S7 and Samsung S5 mini. For each of these devices, we will configure a separate grid node. To set up the grid nodes, create a separate JSON configuration file for both the devices as shown below, and upload them to the Appium server instances.

Node1.json (Android 1)

{
"capabilities":
[
{
"deviceName": "Android 1",
"platformVersion": "8.1",
"maxInstances": 1,
"platformName": "Android",
"browserName": "GoogleChrome"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://10.81.234.7:4723/wd/hub",
"host": "10.81.234.7",
"port": 4723,
"maxSession": 2,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "192.168.25.218",
"hubProtocol": "http"
}
}

Node2.json (Android 2)

{
"capabilities":
[
{
"deviceName": "Android 2",
"platformVersion": "8.1",
"maxInstances": 1,
"platformName": "Android",
"browserName": "GoogleChrome"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://10.81.234.7:4723/wd/hub",
"host": "10.81.234.7",
"port": 4723,
"maxSession": 2,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "192.168.25.218",
"hubProtocol": "http"
}
}

To run the test cases on the same machine with two devices and on two different Appium instances. the Appium Server port must be different for lauchned two Appium instances.

Executing a Test Case on a Specific Node

The node can be equipped with different capabilities and values. Let us consider a scenario where X machine is connected to x1 mobile device, Y machine is connected to y1 mobile device, and Z machine is connected to z1 mobile device.

To execute a test case :

(The following is an example to execute a test case on x1 device)

  1. Find out the UDID of the x1 device.

  2. While registering X machine as a node to the hub, add the following capability:

    1.  --udid UDID_of_x1_device
      As a result, the node command becomes

      appium -p 4724 --udid 5e6453d7d240 --nodeconfig=C:\Users\Desktop\capabilities.json

  3. Click Settings> System Execution Profile> Mobile, and enter the UDID of x1 device in the mapped Execution Profile.

Configuring the Mapped Execution Profile

Either you can create an execution profile to execute on the remote environment or edit an existing execution profile. For more information, refer to Working with Execution Profiles.
Before you execute a test suite, ensure that all the nodes in the network meets the minimum system requirements. For more information, refer to Requirements and Configuration Settings for Mobile Environments.

To configure the settings for executing through Selenium Grid:

  1. Do one of the following:

    • To execute the test suite from a Qualitia client, open the associated execution profile.

    • To execute the offline suite, do the following in the order listed:

      1. Open the offline package folder.

      2. From the Configuration Manager folder, and double-click the Qualitia Offline Configuration Manager. 

      3. Do one of the following;

        1. Click Browse next to Select the Suite Directory, and then locate and select the offline suite.

        2. Enter the location path of the offline suite folder, and press Tab.

      4. Under the Select the profile to edit, select the execution profile created to execute on remote environment.

      5. Select the associated execution profile that is defined to execute on remote environment.
        From the Mapped Execution Profile list, select the execution profile you have opened.

  2. Configure the settings in the associated execution profile. For more information, refer to Requirements and Configuration Settings for Mobile Environments.

  3. Set the ExecutionEnvironment as Remote.

  4. Set the RemoteURL value to a valid remote URL that is IP and port of the remote machine.

    For example: RemoteURL=http://192.168.25.123:4445

  5. Set the GridPlatform value to a valid platform where you want to execute test cases. For example: Set the GridPlatform=Win10.

  6. Click Save.

  • In case you have multiple versions of java, Qualitia uses the version set against the "JAVA_HOME" system variable under System Properties settings of your computer.

  • To execute mobile test cases using Selenium grid, make sure that Appium server is up and running on the designated node.

Suite Execution

Execute the test suite or offline suite you have configured. To know how to execute an offline package, refer to Offline Package.

If you want to use PowerShell Utility on Selenium Mobile Grid to perform parallel execution, refer to Parallel Execution using Power Shell Utility .


  • No labels