AudioExpectation

class AudioExpectation

Returned by

Clone()

Call this method if you want to use API-objects in multiple contexts, e.g. if you want to insert a specific test step in multiple blocks.

Returns:

A copy of this object

Return type:

AudioExpectation

GetComparisonMethod()

Returns the method that will be used to compare the two images.

Returns:

The method of comparison

Return type:

str

GetNoiseResistantComparison()

Returns whether a noise resistant comparison method will be used.

Returns:

True if a noise resistant comparison is used. False otherwise.

Return type:

bool

GetReference()

Returns the current audio reference expression. Depending on the reference type, this can be the path to an audio file or the name of a variable.

Returns:

Path to an audio file or name of a variable.

Return type:

str

GetReferenceType()

Returns the method by which the audio reference is resolved.

Returns:

The type of reference

Return type:

str

GetThreshold()

Returns the minimum confidence value used during comparison.

Returns:

The threhold expression

Return type:

str

SetComparisonMethod(comparisonMethod)

Sets the method that will be used to compare the two audio blocks.

Parameters:
comparisonMethod : str

Either “contains” or “containsNot”

SetNoiseResistantComparison(noiseResistantComparison)

Specifies whether the audio samples should be campared with an algorithm that is designed to be resistant to noise. This option should only be activated if the recording actually contains noise. For recordings without noise the normal comparison provides more robust results. Pleae note that the confidence values will generally be lower when using the noise resistant comparison since a different metric will be used.

Parameters:
noiseResistantComparison : bool

Whether to activate the noise resistant comparison.

SetReference(reference)

Sets the current audio reference expression. Depending on the configured reference type this may be either a path to an audio file or the name of an AudioBlock variable.

Parameters:
reference : str

Path to an audio file or name of a variable.

SetReferenceType(referenceType)

Sets how the audio is referenced. If the type is set to “object”, the reference expression is expected to contain a variable name. The variable must contain an AudioBlock. If the type is set to “workspace” the reference should contain a path relative to the current workspace. The actual audio reference expression can be set with SetReference().

Parameters:
referenceType : str

Either “object” or “workspace”

SetThreshold(threshold)

Sets the minimum confidence value that a match should have to be considered a match. Only if the reference sample is found with a confidence higher than the given threshold will the test step be evaluated with SUCCES.

Parameters:
threshold : str

Expression for the confidence threshold