Skip to main content


Indicate expected outcome for the specific probe execution between two application defined events. This is used to decide if a test has successfully passed or failed.

This is a variation of .rtcSetTestExpectation() that works between given events created using .rtcEvent() .

The condition is evaluated at the end of the test, based on collected information and metrics. The command can be placed anywhere in the script and can appear multiple times with different constraint values.

testRTC offers additional assertion and expectation commands.


Name Type Description
criteria string The criteria to test. See below for the available options
start-event string The starting point in time for the evaluation. Events are creating using rtcEvent()Learn more about event based test expectations
end-event string The ending point in time for the evaluation. Events are created using rtcEvent()Learn more about event based test expectations
message string Message to invoke if criteria isn’t met
level string Level of expectation:
  • “error” – error occurred – fail the test
  • “warning” – consider this as a warning
  • Default value: error


A criteria is comprised of the metric to test, an operator and a value.

For example: “ > 0” will evaluate that the number of incoming video channels is greater than 0.


The available operators for the criteria are:

  • ==
  • >
  • <
  • >=
  • <=
  • !=

Complex expectations

You can also use the boolean operators and or or to build more complex expectations.

An example of using it is when you want to check for a certain threshold only on some of the channels. Assume for example that you have any incoming channels, but some of them are muted so they have no data flowing on them. But you still want to test for frame rate. Here’s how you can now do that:
client.rtcSetEventsExpectation(" == 0 or > 0");

Criteria metrics

The criteria is defined as a chained definition of the object we wish to evaluate, and depends on the metric type we wish to access.

The detailed list of available criteria metrics are found in the description of .rtcSetTestExpectation() .


In the example below, the expectations check for the audio bitrate between two events created using .rtcEvent() in the test script. These events are called ‘Limit Network’ and ‘Stop Limit’.
 // The below expectation is based on the events used to check network configuration
     .rtcSetEventsExpectation(" >= 15", 'Limit Network', 'Stop Limit', "audio bitrate too low", 'error')
     .rtcSetEventsExpectation("audio.out.bitrate >= 15", 'Limit Network', 'Stop Limit', "audio bitrate too low", 'error')

Was this article helpful?

0 out of 0 found this helpful