Skip to main content

Writing Scripts – Sessions

In many test cases, you may want to run different probes that are logically “linked” to sessions. For example, you may wish that different users connect to different video chat rooms when testing a system. testRTC supports the distribution of its probes to multiple sessions, and, in addition, it is possible to define a different logic or role for every probe in the session.

Activate Sessions’ Logic

Things to note when reading the following information;

  • Concurrent probes = the number of browsers/users.
  • Session size = the limit of probes per room.
  • Number of sessions = the number of rooms.

To activate the sessions’ logic, you must use the ‘Session size’ parameter in the test script editor. The logic will be enabled if the value is set to two or higher. The number of sessions is then generated by dividing the number set for concurrent probes by the session size.

Example: If the number of concurrent probes is set to 10 and the session size is set to 2, it will create 5 sessions.

Tools for Sessions

You can use two powerful tools when using sessions in testRTC:

  1. Synchronization: You can synchronize between probes within the same sessions, having a probe wait on actions taken by other probes by using the .rtcWaitForSessionValue().
  2. Variables: New environment variables will be created and managed for you by the testRTC manager so you can use them in the test script.

Introduction to Handling Sessions: Part 1

The following video gives an introduction to the sessions’ logic and how it can be used.

Introduction to Handling Sessions: Part 2

The following video gives another introduction to the sessions’ logic and how it can be used.

Code Sample: Multiple rooms with 2 probes in each

The following code sample creates multiple rooms with 2 probes in a room. Every user will run a different logic. This approach can be used, for example, to test a service that is based on calling action. In this example, the first user in every room will be the caller and the second user will be the callee.
var probeType = Number(process.env.RTC_IN_SESSION_ID); 

  .waitForElementVisible('body', 1000)
  if (probeType === 1) {
    // The caller
        // Sign-in
        .setValue('#user', 'user1')
        .setValue('#password', ['pass1',  client.Keys.ENTER])
        // Call
      // The callee
          // Sign-in
          .setValue('#user', 'user2')
          .setValue('#password', ['pass2',  client.Keys.ENTER])
          // Wait for the call       

      // Give both probes some time to run, so we can collect QoS information

Was this article helpful?

0 out of 0 found this helpful