System Variables

System Variables

Overview

Zoho QEngine provides certain built-in variables, referred to as System Variables, which represent dynamic elements of the system under test. They are pre-defined variables that enhance test case flexibility, ensuring more reliable and adaptable test cases for your testing platforms. These are designed to adapt to different environments, platforms, or states of the application being tested.

These can be categorized into three:
  1. Web variables
  2. Mobile variables
  3. General variables

Web variables

The following system variables are compatible with your web test cases:
  • BROWSER

  • OS

  • SCREEN_RESOLUTION

  • BROWSER_VERSION



Syntax
Return Type
Description 
$BROWSER
STRING
Variable holds details of the browser in which the test case is running.
$OS
STRING
Variable holds details of the OS in which the test case is running.
$SCREEN_RESOLUTION
STRING
Variable holds the screen resolution of the browser in which the test case is running.
$BROWSER_VERSION
STRING
Variable holds the details of the version number of the browser in which the test case is running.

Example

  1. info($BROWSER); // Logs shows the returned value of the variable as: Info - chrome
  2. info($OS); // Logs shows the returned value of the variable as: Info - Ubuntu
  3. info($SCREEN_RESOLUTION); // Logs shows the returned value of the variable as: Info - (1024, 768)
  4. info($BROWSER_VERSION); // Logs shows the returned value of the variable as: Info - 96 

Note: The returned values shown in the example can vary according to the web browser versions and screen resolutions used.

Mobile variables

The following system variables are compatible with your mobile test cases :
  1. OS_VERSION
  2. DEVICE



Syntax
Return Type
Description
$OS_VERSION
STRING
Variable holds the details of the OS version of the device on which the test case is running.
$DEVICE
STRING
Variable holds the details of the device on which the test case is running.

Example

  1. info($OS_VERSION); // Logs shows the returned value of the variable as: Info - 12.0
  2. info($DEVICE); // Logs shows the returned value of the variable as: Info - Pixel_6_API_32

Notes

Note: The returned values shown in the example can vary according to the OS versions and screen devices used.

General variables

The following system variables can be used for both web and mobile test cases:
  • TODAY 
  • TESTCASE_ID

  • IS_PREVIEW_RUN 

  • NOW 

Syntax
Return Type
Description
$TODAY
STRING
Variable holds the current date of the machine or device on which the test case is running.
$TESTCASE_ID
STRING
A unique ID is generated for every test case upon its creation, and this ID is found in the URL of the corresponding test case. This variable is what holds the unique test case ID for the currently running test case.
$IS_PREVIEW_RUN
BOOLEAN

Variable validates whether the test case is running in preview or not.

  • If the value returned is true, the test case is running in preview.

  • If the value returned is false, the test case is running as per test plan.

$NOW
STRING

Variable holds the current date and time.


Example
  1. info($TODAY); // Logs shows the returned value of the variable as: Info - 16/10/2023

  2. info($TESTCASE_ID); // Logs shows the returned value of the variable as: Info - 1090000000722519 

  3. info($IS_PREVIEW_RUN); // Logs shows the returned value of the variable as: Info - true

  4. info($NOW); // Logs shows the returned value of the variable as:  Info - 16/10/2023 17:58
NotesNote: The returned values shown in the example can vary according to the real-time data available.

Related Links

  1. Test Cases
  2. Tasks for Web Testing
  3. Variables