Skip to main content

Ruby Grid Client

Examples - Ruby Grid Execution For SeeTest

SeeTest Ruby Client - Using Grid Execution

require './grid_client'

begin
grid = Mobile::GridClient.new_client_url("cloudUsername", "cloudPassword", "cloudProject", "https://cloud.experitest.com")
client = grid.lockDeviceForExecution("testname","@os='android'", 60, 20000, true, false)
.
.
.
client.releaseClient
end

Create a new GridClient. Fill in the user credentials, details about the cloud server and the project to log into:

**Mobile::GridClient.new_client(userName, password, projectName, domain, port, isSecured)**
**Mobile::GridClient.new_client_access_key(accessKey, domain, port, isSecured)**
**Mobile::GridClient.new_client_url(userName, password, projectName, url)**
**Mobile::GridClient.new_client_url_access_key(accessKey, url)**

Parameters

  • userName: Name of cloud user with which to execute the test

  • password: Password of cloud user with which to execute the test

  • projectName: Name of the project to use

  • accessKey:  See more in Use Access Keys for Authentication.

  • domain: The hostname or the IP-address of the cloud server

  • port: The port listened by the cloud server

  • isSecured: Is a secure connection to the cloud server

  • URL: URL of cloud user with which to execute the test

Then use the grid client created to request a device to run your test on with the following command:

****grid.lockDeviceForExecution(testName, deviceXpathQuery, reservetionTime, timeout, releaseDevice, onlyAvailable)****

Parameters

  • testName: Name of the test to be shown in Cloud UI and Report (string)
  • deviceQuery: XPath Search query to look up devices for test execution. More info can be found in the documentation. (string)
  • reservationTimeInMinutes: Reservation time in minutes. (integer)
  • timeout: Timeout in milliseconds to wait for an available device according to the search query. (long)
  • releaseDevice: (boolean):
    • Gives the capability to not release a device after the test ends.
      • default value is 'true' .
      • In case the device is already reserved or uses future reservations when the test starts then releaseDevice capability will not have any effect and the device will not be released. 
  • onlyAvailable: (boolean)
    • When onlyAvailable=true:

      • Use only available devices.
      • If the method without onlyAvailable parameter is used, the default used is: onlyAvailable=false
    • When onlyAvailable=false:

      • Use devices in the following priority: STAW, manual, reserved, available.

info

Ruby requirements: Ruby version 2.4 and above. Gems: rubyzip, rest-client -v 1.8.0