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_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 agent’s name. The agent name format is [RTC_TEST_NAME]-[RTC_AGENT_NUM]
RTC_AGENT_COUNT The total number of agents in the test. This corresponds to the concurrent agents value that is set when the test is executed
RTC_AGENT_NUM The (numeric) index of this agent from total number of agents in the test (starts with 1)
RTC_ITERATION_COUNT The total number of iterations in the test
RTC_ITERATION_NUM The (numeric) index of this iteration from total number of iterations in the test (starts with 1)
RTC_SESSION_SIZE The size of a configured session (run option #session value)
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_OS The agent’s operating system
RTC_LOCATION The agent’s location
RTC_BROWSER The 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):

 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?

Related Articles

Leave a Reply 0 comments

Leave a Reply: