You create assertions to validate model outputs by configuring test conditions with
operators like equals, contains, or range comparisons.
About this task
When you create an assertion, you can control when it runs:
- Keep the Run at deployment option checked for the assertion to run during
both testing and deployment.
- Clear the Run at deployment option for the assertion to run during
testing only.
Important: If assertions fail during deployment, the deployment of the decision service
fails. To resolve the issue and be able to deploy:
- Return to the Run tab and fix the failing assertions.
- Share your changes and create a new version.
- Retry the deployment.
Procedure
- Optional: If you are creating an assertion for a task model, select the
function that you want to run.
- Click Add test data set.
- Go to the Assertions tab and click Add
assertion.
- Expand the assertion and configure the following fields:
- Label
- Provide a meaningful name for the assertion. If no label is provided, a default value in the
format
#<assertion number> is used.
- Path
- Select the path to the output value that you want to validate.
- For decisions that return a single value, such as a number or string, only
root
is available.
- Operator
- Select the type of comparison that you want to perform. The following operators are
supported:
Table 1. List of supported operators
| Operator |
Details |
| equals |
These operators can be used on any type of data.
They support the Ignore order option for lists.
|
| does not equal |
| contains |
These operators can be used on any type of data, except numbers.
They
support the Ignore order option for lists. |
| does not contain |
| is greater than |
These operators can be used on numbers. |
| is greater than or equal to |
| is less than |
| is less than or equal to |
| is within a range |
| is not within a range |
- Ignore order
- This field is only available for lists. When checked (set to
true), the list
comparison ignores the element order. It is disabled (set to false) by
default.
- When the Ignore order option is checked and the assertion fails, the
failure result may be less precise than when the order is considered.
- Expected value
- Define the value to compare against:
- Enter the value manually for strings and numbers.
- Use the picker for dates and times.
- Use the checkbox for Boolean values. Checking the box sets the value to
true.
Note: For decision and predictive models, you can create assertions that are automatically
populated. To do this, click the + button (Add new
assertion) located next to the output of an end decision. After clicking
+, you can choose to create an assertion for a specific output field or for
all fields.
- Click Run to run the assertion and verify the
results.
Results
The assertion results are displayed in the results pane under Assertion
results. The format of the results depends on the model type:
- For decision and predictive models, a summary indicator shows the number of assertions that
succeeded and failed. To see more details, you can expand the Assertion
results section and review each failed assertion individually.
- For task models, assertion results are displayed in JSON format.