In a nutshell
System variables in Zoho QEngine are predefined variables that automatically capture runtime properties of the system under test. They reflect values such as the browser, OS, device, and current date and time during test execution. They are categorized into Web, Mobile, and General, each capturing properties relevant to the platform and context of the test run.
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:
- Web variables
- Mobile variables
- 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
- info($BROWSER); // Logs shows the returned value of the variable as: Info - chrome
- info($OS); // Logs shows the returned value of the variable as: Info - Ubuntu
- info($SCREEN_RESOLUTION); // Logs shows the returned value of the variable as: Info - (1024, 768)
- 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 :
OS_VERSION
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
- info($OS_VERSION); // Logs shows the returned value of the variable as: Info - 12.0
- info($DEVICE); // Logs shows the returned value of the variable as: Info - Pixel_6_API_32
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
info($TODAY); // Logs shows the returned value of the variable as: Info - 16/10/2023
info($TESTCASE_ID); // Logs shows the returned value of the variable as: Info - 1090000000722519
info($IS_PREVIEW_RUN); // Logs shows the returned value of the variable as: Info - true
- info($NOW); // Logs shows the returned value of the variable as: Info - 16/10/2023 17:58