Skip to main content

OpenVidu sample test script

OpenVidu is an open source video conferencing framework with a ready-to-use UI. If you are using it as your baseline, then the script provided here is a good starting point.

Preparation

The script below creates random rooms on OpenVidu. If you are using user authentication or need other means to create and join rooms, then you will need to edit this script a bit further. Otherwise, you can just use the script “as is” – just configure the probes the way you want it before running it.

Using the test script

In testRTC, create a new test script:

  1. Copy the code from the bottom of this article to your test script (or use the existing sample in your account)
  2. Decide the number of probes you want to use
    1. 2 Concurrent probes will be good starting point
    2. Set the Session size to the number of concurrent probes for this sample
  3. Replace the Service URL of the script with the URL where your OpenVidu server is located. The sample script was created in front of this URL: https://demos.openvidu.io/openvidu-call/#/

Test execution

Run the script. It does everything for you.

If you want, you can join the same room from your browser once you see the URL in the progress messages of the test.

Test script code
/*

    SCENARIO
    * Browser joins room URL
    * Browser waits in a call for a few minutes
    
    THINGS TO PLAY WITH
    * Probe configurations (look after the script):
      - Location of probes
      - Media files to use
      - Browser version
    * Length of test
    * Modify to run on your own service
*/


// Variables that we will use in this example
var roomUrl = process.env.RTC_SERVICE_URL + 'testRTC-' + process.env.RTC_SESSION_NAME;
var probeType = Number(process.env.RTC_IN_SESSION_ID);
var sec = 1000;

// Join the room
client
    .pause(probeType * 200) //Staggering 
    .rtcInfo(roomUrl)
    .rtcProgress('open ' + roomUrl)
    .url(roomUrl)
    .waitForElementVisible('#videoRoomNavBar #joinButton', 60 * sec)
    .pause(300) //wait for page render 
    .click("#videoRoomNavBar #joinButton")

client
    .pause(60 * sec)
    .rtcScreenshot("in call")
    .pause(60 * sec);

Was this article helpful?

0 out of 0 found this helpful