Indicate expected outcome for the specific agent execution.

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 for different constraints.


Arguments:

Name Type Description
criteria string

The criteria to test. See below for the available options

message string Message to invoke if criteria isn't met
level string Level of expectation:
"error" - error occured - fail the test 
"warning" - consider this as a warning
Default value: error


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 video in channels is greater than 0.


Operators:

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


Criteria metrics:

The criteria is defined as a chained definition of the object we wish to evaluate.

The chain hierarchy is: 


Media type (audio / video) . Direction (in / out) . channels . Evaluated criteria


Wher the channels level is optional, i.e. both formats will work:

video.in.bitrate - Evaluate the total bitrate of all video in channels

audio.out.channel.bitrate - Evaluate the bitrate of every audio out channel


Evaluated criteria Media type Direction Global (all channels) Per channel Description and example
Number of channels
audio | video in | out
Yes No Evaluate number of channels
"video.out >= 1"
Channel is empty
audio | video
in | out
Yes
Yes
Will evaluate if total number of sent/received packets is zero
"video.in.empty == 0"
Bitrate audio | video in | out  Yes  Yes "audio.out.bitrate >= 3" - evaluate the TOTAL aggregated bitrate of all audio out channels
"audio.out.channel.bitrate > 3" - evaluate the value of EVERY audio out channel' bitrate (evaluating all channels, per channel)
Packetloss audio | video in | out Yes Yes Evaluate channels' packetloss (in %)
"packetloss < 2"
Data audio | video in | out Yes
Yes  Evaluate total amount of sent/received bytes in the whole session
Packets audio | video in | out Yes Yes  Evaluate the total number of packets sent/received
Roundtrip audio | video in | out Yes Yes  Evaluate the average round trip time
Jitter audio | video in | out Yes Yes  Evaluate the average jitter value
Codec audio | video
in | out Yes Yes
Evaluate the codec name
"audio.out.codec.channel == 'OPUS'"
"audio.out.codec == 'opus,vp8'"
fps video in | out
Yes
Yes
Evaluate frames per second
Resolution video in | out
Yes
Yes
Evaluate video resolution
"video.in.channel.resolution == '640x480' "
Time  - Evaluate the value of a timer, managed using the function .rtcGetTimer()
Metric  - - Evaluate the value of a metric, managed using the function .rtcSetMetric()



Code examples:   

.rtcSetTestExpectation("audio.in == 2")
.rtcSetTestExpectation("video.in > 3")
.rtcSetTestExpectation("video.out == 0")
.rtcSetTestExpectation("audio.in == 1", "No incoming audio channel", "error")
.rtcSetTestExpectation("audio.in.channel.bitrate > 0", "No incoming audio data", "warning")


Code execution example:

 

    .rtcSetTestExpectation("audio.in.packets < 2500")

 

p8RJTbXd-8Jh-1HHDojmHuPJHobt6AAj9w.png


Expectations' evaluation scope

 

if (agentType === 1) {

	.rtcSetTestExpectation("video.out.channel.bitrate > 0")

	// video.OUT.channel.bitrate > 0
	// will be evaluated only for the code here
	
}
else // agentType is not 1
{
	.rtcSetTestExpectation("video.in.channel.bitrate > 0")

	// video.IN.channel.bitrate > 0
	// will be evaluated only for the code here
}