Skip to content

Assertion

Vivek Dhayalan edited this page Mar 29, 2022 · 2 revisions

Assertion

Restel’s Assertion can be defined in the assertion field of the test suite execution sheet. Assertions are validated before invoking the test API call.

{  
   "<Assertion_name>": 
   {
	“condition”:[“assert_type”
	"<actual_value>",
	"<expected_value>"],
        “message”: “”	
   }
}
The following are assertion type that are supported at this moment: * EQUAL, * GREATER, * LESSER, * NULL, * NOT_NULL, * NOT_EQUAL, * TRUE, * FALSE
Assert-Type Example

EQUAL or NOT_EQUAL

{ "Assert1": { "condition": [ "equal", "${user_exec.user_api.response[0].name}", "Tom" ], "message": "Validation success" } }

NULL or NOT_NULL

{ "Assert2": { "condition": [ "not_null", "${user_exec.user_api.response[0].id}" ], "message": "Validation success" }}

GREATER or LESSER

{ "Assert1": { "condition": [ "greater", "${user_exec.user_api.response[0].id}", "20" ], "message": "Validation success" } }

TRUE or FALSE

{ "Assert2": { "condition": [ "true", "${user_exec.user_api.response[0].isAdmin}" ], "message": "Validation success" }}