Skip to main content

Using event-based test expectations

testRTC enables you to set expectations to check certain metrics throughout the test. These are a kind of assertions that are calculated on the probe level at the end of a test run.

To do that, you can use our .rtcSetTestExpectation() and .rtcSetCustomEventsExpectation() script commands.

The format of this command has an optional start and end events that you can indicate, which will give you the ability to check a metric’s value in a given time span and not throughout the duration of the test.

An example for using it can be anything from checking that a muted video or audio channel is sending less (or no) media, or that a given network configuration change affected your media server the way you intended it to.


The following script code piece shows how this can be used:
if (agentType === 1) {
        .rtcEvent('Call Drop Start', 'global')
        .rtcProgress('Call Drop Start')
        .rtcSetNetworkProfile('Call Drop')

// 2 minutes with bandwidth limits
    .pause(8 * sec)
    .pause(8 * sec);

if (agentType === 1) {
        .rtcSetNetworkProfile('') // back to pristine network conditions
        .rtcProgress('Call Drop Stop')
        .rtcEvent('Call Drop Stop', 'global');

        " >= 200",
        'Call Drop Start', 'Call Drop Stop',
        "Expected a lower bitrate" , 'error')
    .pause(30 * sec)
    .rtcScreenshot('BACK TO NORMAL')
    .pause(30 * sec)

Was this article helpful?

0 out of 0 found this helpful