Support & information center

Environment variables

When starting an agent, testRTC provides some environment parameters to the agent that can be used in the script.

To access an environment parameter, please use the following expression:

process.env.PARAMETER_NAME

For example:

.url(process.env.RTC_SERVICE_URL)
Code language: CSS (css)

The supported environment parameters:

RTC_SERVICE_URLThe string that was entered in the test configuration page, ‘Service URL’ field
RTC_TEST_NAMEThe random name allocated for the specific test execution
RTC_AGENT_NAMEThe probe’s name. The agent name format is [RTC_TEST_NAME]-[RTC_AGENT_NUM]
RTC_AGENT_COUNTThe total number of probes in the test. This corresponds to the concurrent probes value that is set when the test is executed
RTC_AGENT_NUMThe (numeric) index of this probe from total number of probes in the test (starts with 1)
RTC_SESSION_SIZEThe size of a configured session (Session Size parameter in the test script editor)
RTC_SESSION_COUNTThe total number of sessions in the test.
RTC_SESSION_IDXThe numeric index of this session from total number of sessions in the test (starts with 1)
RTC_SESSION_NAMEThe session unique name for the test. The session name includes the session’s (numeric) index of this session from total number of sessions in the test (starts with 1). The session name format is [RTC_TEST_NAME]-“room”[RTC_SESSION_IDX]
RTC_IN_SESSION_IDThe (numeric) index of this agent in the specific session (starts with 1)
RTC_TEST_SCRIPT_NAMEThe name of the test script being executed
RTC_TIMEOUTThe maximum duration in milliseconds of the test before it gets canceled automatically
RTC_OSThe probe’s operating system
RTC_LOCATIONThe probe’s location
RTC_BROWSERThe probe’s browser version
RTC_NETWORK_PROFILEThe probe’s configured network profile
RTC_FIREWALL_PROFILEThe probe’s configured firewall profile
RTC_TEST_RUN_IDThe testRunId allocated for this test run
RTC_RUN_TYPEThe type of test – either “test” or “monitor”
RTC_RUN_COUNTThe number of times this specific test script has been executed
RTC_EXTRA_TABSIndicates how many additional tabs are used by testRTC for its operation. See switching windows and tabs for more information

Remarks:

  • All environment parameters are represented as string values. You can use Number(parameter) to convert them into integers
  • If you want to check the values of variables on a test result, you can look at the Logs section of the test results of a specific probe. All variables will be listed inside the Test Script log
  • You can add your own custom environment variables when invoking a test via the API, passing them in as environmentVariables in JSON

Environment parameters example (4 concurrent users, 2 users in a session):

 AgentRTC_AGENT_NAMERTC_SESSION_NAMERTC_IN_SESSION_IDRTC_AGENT_NUM
1impressive-test-1impressive-test-room111
2impressive-test-2impressive-test-room122
3impressive-test-3impressive-test-room213
4impressive-test-4impressive-test-room224

For further information about sessions management, please refer to synchronization commands.

Was this article helpful?

Related Articles