Support & information center

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 .rtcSetTestExpectations() script command.

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 start and end events can be taken from named events you set by the use of .rtcEvent() or by using “start” and “end” to indicate the start and end time of the test.

The following script code piece shows how this can be used:

if (agentType === 1) { client .rtcEvent('Call Drop Start', 'global') .rtcProgress('Call Drop Start') .rtcSetNetworkProfile('Call Drop') } // 2 minutes with bandwidth limits client .pause(8 * sec) .rtcScreenshot('LIMITED') .pause(8 * sec); if (agentType === 1) { client .rtcSetNetworkProfile('') // back to pristine network conditions .rtcProgress('Call Drop Stop') .rtcEvent('Call Drop Stop', 'global'); } client .rtcSetEventsExpectation( " >= 200", 'Call Drop Start', 'Call Drop Stop', "Expected a lower bitrate" , 'error') .pause(30 * sec) .rtcScreenshot('BACK TO NORMAL') .pause(30 * sec) .rtcScreenshot('END');

Was this article helpful?

Related Articles