# Custom assertion result summary templates


This feature is introduced in vREST NG v2.3.2.

vREST NG allows you to customise the assertion result summary which is shown in the following places:

  1. Assertion Results tab in the vREST NG Application
  2. Console/Logger output of the vREST NG CLI
  3. Assertion Results tab in the vREST NG Dashboard Service.

You may customise the assertion result summary templates in the vREST NG Application by visiting the Configuration tab > Miscellaneous Section > Assertion result summary templates sub section as shown in figure below:

By default, default templates created by vREST are shown here. You may customise these templates as per your own needs. Further the following extra information will be available to these templates apart from variables and utility methods:

  1. $assertion: This variable contains the information related to assertion in context. The value of this variable is an object and contains the following keys:
    1. source: Assertion's source label.
    2. property: Assertion's property field value.
    3. operator: Assertion's operator label.
    4. expectedValue: Assertion's expected value.
    5. trimmedExpectedValue: Assertion's expected value trimmed at 50 characters.
    6. actualValue: Assertion's actual value.
    7. trimmedActualValue: Assertion's actual value trimmed at 50 characters.
    8. isPassed: Boolean flag to indicate whether the assertion is passed or not.
    9. meta: Meta data object containing key value pairs. You may access specific key using syntax {{$assertion.meta.KEY_NAME}}

We have 3 special templates and all other templates are operator specific templates.

  1. prefix: This template will be prefixed to all the operator specific templates. So, if you want to add some extra meta data in the assertion result summary then just update this template.
  2. suffix: Similarly, this template will be suffixed to all the operator specific templates.
  3. default: This template will be used for custom validators/operators.
  4. Rest are operator specific templates to customize the operator specific assertion result summary.

Now, let's try to understand, how you may customise the built-in templates. Suppose, we also want to print specific meta data in the assertion results summary. For this, you may just update the prefix template to the following.

[{{$assertion.meta.label}}] {{$assertion.source}} - {{$assertion.operator}} - {{ifElse('{{$assertion.property}}','[Path - {{$assertion.property}}]', '')}} 

Note: {{ifElse(condition, onTrue, onFalse)}} is a built-in utility method to print conditional statements.

Now, suppose you have specified a Status Code assertion that is checking whether the status code is equal to number 200 or not And suppose you have received the actual value as 400. And suppose you have also specified a meta data where key is label and value is Status code validation.

Then it will print the following assertion result summary:

[Status code validation] Status Code - Equal to number -  `400` was not a number equal to number `200`.