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.
Arguments
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:
|
Criteria
A criteria is comprised of the metric to test, an operator and a value.
For example: “video.in > 0” will evaluate that the number of incoming video channels is greater than 0.
Operators
The available operators for the criteria are:
- ==
- >
- <
- >=
- <=
- !=
Complex expectations
You can also use the boolean operators and or or to build more complex expectations.
client.rtcSetEventsExpectation("video.in.channel.bitrate == 0 or video.in.channel.fps > 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() .
Example
// The below expectation is based on the events used to check network configuration
client
.rtcSetEventsExpectation("audio.in.bitrate >= 15", 'Limit Network', 'Stop Limit', "audio bitrate too low", 'error')
.rtcSetEventsExpectation("audio.out.bitrate >= 15", 'Limit Network', 'Stop Limit', "audio bitrate too low", 'error')
;