You're viewing legacy documentation for API Fortress (deployed via an on-premises container). To view documentation for the new SaaS version of API Fortress — now known as Sauce Labs API Testing and Monitoring (with Sauce Connect tunnels) — see API Testing on the Sauce Labs Cloud.
This assertion is used to check if the element described by the expression matches at least one item from a given list. For example, the category of a product is one of the approved categories such as men, women, or children.
|Type||'integer' of 'float'||No|
|Mode||'all' or 'one'||No|
|Level||'error' or 'warning'||No|
|Execute if item exists||'true' or 'false'||No|
|Stop test if fails||'true' or 'false'||No|
- Expression: The path to the element we want to operate on (e.g.,
payload.ProductID). See Expression for more details.
- Value: The value we want to compare the expression to.
- Type: The data type of the value. This attribute is optional. If no type is defined the values will be compared as strings. If the type is set the values will evaluated with the chosen comparator (ex: ‘integer’ as a whole number, ‘float’ as a decimal number).
- Mode: Specify if all the same elements in the payload should match the assertion (‘all’) or if only one element (‘one’) is enough.
- Level: Specify if the assertion fails whether it should be considered an ‘error’ or just a ‘warning’.
- Modifier: The assertion is considered verified if it does not pass.
- Execute if item exists: The assertion is evaluated only if the element exists. This is useful when the element does not always exist.
- Stop test if fails: The test will be immediately stopped if the assertion fails.
- Comment: Add comment messages in the form of a string data type.
A warning will not trigger alerts (such as email or text messages).
Code View Examples
<assert-in expression="”data.type”" value="”[‘paperbook’,’ebook’]”" />
<assert-in expression="”data.price”" value="”[5.50,7,9.79]”" type="”float”" />