Assertion
Pre-request operations are performed before the request is sent, allowing for custom scripts and database connections. These are commonly used for setting input parameters, printing data, etc.
Post-response operations take place after a request is sent and are typically used for setting variables, performing assertions, and similar tasks. They also support custom scripts and database connections.
If you're not familiar with scripting and cannot write scripts proficiently, you can perform assertion operations through a visual interface. This feature is primarily used for testing and verifying the results of an interface after it has been sent. Currently, it supports direct assertion verification of Response JSON, Response XML, Response Text, Response Header, Response Cookie, Response Code, Response Time, temporary variables, environment variables, and global variables.
Add Assertions
Post-response – Add Assertions
View the results from here
Assertions on Response JSON
Assertions on Response XML
Assertions on Response Text
Assertions on Response Header/Response Cookie
The validation of header and cookie is similar and will not be further elaborated.
Assertions on Response Status Code
Directly assert on the response status code.
Assertions on Response Time
Directly assert on the interface's response time.
Assert on Temporary Variables, Environment Variables, Global Variables
The usage of temporary, environment, and global variables is the same and will not be further elaborated.
Assertions on variables are often used to check if the variable has changed after the interface is sent.
View variables from here
Use of Assertion Conditions
When the condition is Eq(equal to)
, (NEq)not equal to
, LT(less than)
, LTE(less than or equal to)
, GT(greater than)
, GTE(greater than or equal to)
, Contains
, NContains(does not contain)
, you can fill in the comparison value in the input box, and variables can be used, e.g.: {{key}}
.
When the condition is Regex (regular expression matching), you can enter a regular expression in the input box, for example,/[a-z]*\d*/
, to match the content with the expected pattern.
When the condition is In(belongs to the set)
, NIn(does not belong to the set)
, split multiple elements by pressing enter