Loadero constants
Loadero offers some constants that can be accessed in the script. Though the script itself is shared across all participants of the test, the participants have their own constants that can uniquely identify them within the test. Loadero constants hold information relevant to the participant that is executing the test such as:
- unique identifier and name of a participant or of the group that the participant is in;
- the participant's configuration fields values (such as video feed, location, etc.);
- global test parameters such as test name, participant timeout, and start interval - these will be identical for all participants of the test.
The method of accessing these constants differs depending on the language. All available constants are given in the list below, followed by examples of how these may be useful.
As these are constants, they can only be accessed for reading and cannot be changed during the test run itself. Their values are initialized when the test begins execution.
- JavaScript + Nightwatch.js
- Java + TestUI
- Python + Py-TestUI
Loadero constants are available through the client.globals
directive. All of
the constants provided below should be prefixed with client.globals.
, e.g.,
client.globals.participant.globalID
.
participant.globalID
(Number): an ID that uniquely identifies the participant across the whole test. These IDs start from 0 and are sequential, i.e., a test with 60 participants will haveparticipant.globalID
values ranging from 0 to 59.participant.id
(Number): an ID that uniquely identifies the participant within its group. If there are multiple groups in the test, then this ID may occur multiple times across the whole test. These IDs start from 0 within each group and are sequential, i.e., a test with 2 groups of 10 participants will haveparticipant.id
values ranging from 0 to 9 in each group.participant.name
(String): name of the participant as had been defined in its participant configuration.group.id
(Number): an ID that uniquely identifies the group that the participant is in. This ID is unique across the whole test. These IDs start from 0 and are sequential, i.e., a test with 10 groups will havegroup.id
values ranging from 0 to 9.group.name
(String): name of the group as had been defined in the group's configuration.run.id
(Number): an ID that uniquely identifies the run across all runs ever executed. This ID will never reoccur for any other test run. This value will be identical for all participants in the test run. This ID is generated dynamically at the time of launching the test run and attempting to predict it is not recommended.run.participant.id
(Number): an ID that uniquely identifies the participant across all runs ever executed. This ID will never reoccur for a participant in any test. These IDs are generated dynamically at the time of launching the test run and attempting to predict them is not recommended.test.name
(String): name of the test being executed, as had been defined in the test configuration.test.participantTimeout
(Number): participant timeout of the test being executed, as had been defined in the test configuration. The value is in seconds.test.startInterval
(Number): start interval of the test being executed, as had been defined in the test configuration. The value is in seconds.test.totalParticipants
(Number): the total amount of participants that are being simulated by the test run.audioFeed
(String): the configured audio feed value for the participant.browser
(String): the configured browser version for the participant.computeUnit
(String): the configured amount of compute units for the participant.location
(String): the configured location for the participant.network
(String): the configured network conditions for the participant. This considers only the network conditions the user was initialized with. If theupdateNetwork()
command has been used to update the network configuration, then the Loadero constant will still reference the original configuration.videoFeed
(String): the configured video feed for the participant.
Loadero constants are available through the globalConfig
variable via getters.
All of the getters provided below should be prefixed with globalConfig.
, e.g.,
globalConfig.getParticipant().getGlobalId()
.
getParticipant().getGlobalId()
(Integer): an ID that uniquely identifies the participant across the whole test. These IDs start from 0 and are sequential, i.e., a test with 60 participants will havegetParticipant().getGlobalId()
values ranging from 0 to 59.getParticipant().getId()
(Integer): an ID that uniquely identifies the participant within its group. If there are multiple groups in the test, then this ID may occur multiple times across the whole test. These IDs start from 0 within each group and are sequential, i.e., a test with 2 groups of 10 participants will havegetParticipant().getId()
values ranging from 0 to 9 in each group.getParticipant().getName()
(String): name of the participant as had been defined in its participant configuration.getGroup().getId()
(Integer): an ID that uniquely identifies the group that the participant is in. This ID is unique across the whole test. These IDs start from 0 and are sequential, i.e., a test with 10 groups will havegetGroup().getId()
values ranging from 0 to 9.getGroup().getName()
(String): name of the group as had been defined in the group's configuration.getRun().getId()
(Integer): an ID that uniquely identifies the run across all runs ever executed. This ID will never reoccur for any other test run. This value will be identical for all participants in the test run. This ID is generated dynamically at the time of launching the test run and attempting to predict it is not recommended.getRun().getParticipant().getId()
(Integer): an ID that uniquely identifies the participant across all runs ever executed. This ID will never reoccur for a participant in any test. These IDs are generated dynamically at the time of launching the test run and attempting to predict them is not recommended.getTest().getName()
(String): name of the test being executed, as had been defined in the test configuration.getTest().getParticipantTimeout()
(Integer): participant timeout of the test being executed, as had been defined in the test configuration. The value is in seconds.getTest().getStartInterval()
(Integer): start interval of the test being executed, as had been defined in the test configuration. The value is in seconds.getTest().getTotalParticipants()
(Integer): the total amount of participants that are being simulated by the test run.getAudioFeed()
(String): the configured audio feed value for the participant.getBrowser()
(String): the configured browser version for the participant.getComputeUnit()
(String): the configured amount of compute units for the participant.getLocation()
(String): the configured location for the participant.getNetwork()
(String): the configured network conditions for the participant. This considers only the network conditions the user was initialized with. If theupdateNetwork()
command has been used to update the network configuration, then the Loadero constant will still reference the original configuration.getVideoFeed()
(String): the configured video feed for the participant.
Loadero constants are available under GLOBALS
. All of the constants provided
below should be prefixed with GLOBALS.
, e.g., GLOBALS.participant.global_id
.
participant.global_id
(int): an ID that uniquely identifies the participant across the whole test. These IDs start from 0 and are sequential, i.e., a test with 60 participants will haveparticipant.global_id
values ranging from 0 to 59.participant.id
(int): an ID that uniquely identifies the participant within its group. If there are multiple groups in the test, then this ID may occur multiple times across the whole test. These IDs start from 0 within each group and are sequential, i.e., a test with 2 groups of 10 participants will haveparticipant.id
values ranging from 0 to 9 in each group.participant.name
(str): name of the participant as had been defined in its participant configuration.group.id
(int): an ID that uniquely identifies the group that the participant is in. This ID is unique across the whole test. These IDs start from 0 and are sequential, i.e., a test with 10 groups will havegroup.id
values ranging from 0 to 9.group.name
(str): name of the group as had been defined in the group's configuration.run.id
(int): an ID that uniquely identifies the run across all runs ever executed. This ID will never reoccur for any other test run. This value will be identical for all participants in the test run. This ID is generated dynamically at the time of launching the test run and attempting to predict it is not recommended.run.participant.id
(int): an ID that uniquely identifies the participant across all runs ever executed. This ID will never reoccur for a participant in any test. These IDs are generated dynamically at the time of launching the test run and attempting to predict them is not recommended.test.name
(str): name of the test being executed, as had been defined in the test configuration.test.participant_timeout
(int): participant timeout of the test being executed, as had been defined in the test configuration. The value is in seconds.test.start_interval
(int): start interval of the test being executed, as had been defined in the test configuration. The value is in seconds.test.total_participants
(int): the total amount of participants that are being simulated by the test run.audio_feed
(str): the configured audio feed value for the participant.browser
(str): the configured browser version for the participant.compute_unit
(str): the configured amount of compute units for the participant.location
(str): the configured location for the participant.network
(str): the configured network conditions for the participant. This considers only the network conditions the user was initialized with. If theupdateNetwork()
command has been used to update the network configuration, then the Loadero constant will still reference the original configuration.video_feed
(str): the configured video feed for the participant.
Sample Usage
The example given below only aims to demonstrate how the variables could be used but any websites and selectors referenced are made up, the script isn't actually valid and executing it will result in a failed test.
- JavaScript + Nightwatch.js
- Java + TestUI
- Python + Py-TestUI
client => {
client
// Each group of participants will have their own room
.url(`https://somewebrtcsite.com/?roomId=${client.globals.group.id}`)
// Set a unique name for each participant for tracking purposes
// E.g., "P0", P1", and so forth
.setValue(
"#username",
"P" + client.globals.participant.globalID
)
.click("#joinRoom");
// Assuming that everyone is muted automatically
// Everyone who isn't designated to stay muted should unmute
if (client.globals.participant.name !== "MutedAttendee") {
client.click("#unmute");
}
// Remain in the call for 15 minutes
client.pause(15*60*1000);
}
public void testUIWithLoadero() {
// Each group of participants will have their own room
String roomUrl = String.format(
"https://somewebrtcsite.com/?roomId=%s",
globalConfig.getRun().getId()
);
open(roomUrl);
// Set a name for each participant for tracking purposes
// E.g., "Host0", "Attendee7", "MutedAttendee24"
String participantName = String.format(
"P%s",
globalConfig.getParticipant().getGlobalId()
);
E(byCssSelector("#username")).sendKeys(participantName);
E(byCssSelector("#joinRoom")).click();
// Assuming that everyone is muted automatically
// Everyone who isn't designated to stay muted should unmute
if (globalConfig.getParticipant().getName() != "MutedAttendee") {
E(byCssSelector("#unmute")).click();
}
// Remain in the call for 15 minutes
sleep(15 * 60 * 1000);
}
def test_on_loadero(driver: TestUIDriver):
# Each group of participants will have their own room
room_url = f"https://somewebrtcsite.com/?roomId={GLOBALS.run.id}"
driver.navigate_to(roomUrl)
# Set a name for each participant for tracking purposes
# E.g., "Host0", "Attendee7", "MutedAttendee24"
participant_name = f"P{GLOBALS.participant.global_id}"
e(driver, "css", "#username").send_keys(participant_name)
e(driver, "css", "#joinRoom").click()
# Assuming that everyone is muted automatically
# Everyone who isn't designated to stay muted should unmute
if GLOBALS.participant.name != "MutedAttendee":
e(driver, "css", "#unmute").click()
# Remain in the call for 15 minutes
time.sleep(15 * 60)