Knowledge Base

  1. Home
  2. Knowledge Base
  3. Technical Support
  4. Script Commands
  5. Environment variables
  1. Home
  2. Knowledge Base
  3. Technical Support
  4. 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_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 agent’s name. The agent name format is [RTC_TEST_NAME]-[RTC_AGENT_NUM]
RTC_AGENT_COUNTThe total number of agents in the test. This corresponds to the concurrent agents value that is set when the test is executed
RTC_AGENT_NUMThe (numeric) index of this agent from total number of agents in the test (starts with 1)
RTC_ITERATION_COUNTThe total number of iterations in the test
RTC_ITERATION_NUMThe (numeric) index of this iteration from total number of iterations in the test (starts with 1)
RTC_SESSION_SIZEThe size of a configured session (Session Size parameter in the test script editor)
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_OSThe agent’s operating system
RTC_LOCATIONThe agent’s location
RTC_BROWSERThe agent’s browser version

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

Leave a Reply 0 comments

Leave a Reply: