Skip to main content

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)

The supported environment parameters

RTC_SERVICE_URL The string that was entered in the test configuration page, ‘Service URL’ field
RTC_TEST_NAME The random name allocated for the specific test execution
RTC_AGENT_NAME The probe’s name. The agent name format is [RTC_TEST_NAME]-[RTC_AGENT_NUM]
RTC_AGENT_COUNT The total number of probes in the test. This corresponds to the concurrent probes value that is set when the test is executed
RTC_AGENT_NUM The (numeric) index of this probe from total number of probes in the test (starts with 1)
RTC_SESSION_SIZE The size of a configured session (Session Size parameter in the test script editor)
RTC_SESSION_COUNT The total number of sessions in the test.
RTC_SESSION_IDX The numeric index of this session from total number of sessions in the test (starts with 1)
RTC_SESSION_NAME The 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_ID The (numeric) index of this agent in the specific session (starts with 1)
RTC_TEST_SCRIPT_NAME The name of the test script being executed
RTC_TIMEOUT The maximum duration in milliseconds of the test before it gets canceled automatically
RTC_OS The probe’s operating system
RTC_LOCATION The probe’s location
RTC_BROWSER The probe’s browser version
RTC_NETWORK_PROFILE The probe’s configured network profile
RTC_FIREWALL_PROFILE The probe’s configured firewall profile
RTC_TEST_RUN_ID The testRunId allocated for this test run
RTC_RUN_TYPE The type of test – either “test” or “monitor”
RTC_RUN_COUNT The number of times this specific test script has been executed
RTC_EXTRA_TABS Indicates 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):

Agent RTC_AGENT_NAME RTC_SESSION_NAME RTC_IN_SESSION_ID RTC_AGENT_NUM
1 impressive-test-1 impressive-test-room1 1 1
2 impressive-test-2 impressive-test-room1 2 2
3 impressive-test-3 impressive-test-room2 1 3
4 impressive-test-4 impressive-test-room2 2 4

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

Was this article helpful?

0 out of 0 found this helpful