The json assertion allows us to quickly locate a certain field in the response data, of course, the premise is that the response data is in json format, so if the response data is in json format, it is quite convenient to use json assertion.
Still take the previous interface as an example
Url: https://data.cma.cn/weatherGis/web/weather/weatherFcst/getCurrentCondition
HTTP Method: Post
Request:
staId: 54511
Response:
{"v01301":"54511","v13003":71,"v12001":24.3,"v13011":0.0,"v11292":229.0,"v11293":1.6,"v20003":5.0,"d_DATETIME":2019,"d_IYMDHM":1566792218000,"d_RECORD_ID":2.08712269E9}
-
Add a Json assertion
-
The fields you want to judge in maintenance
-
View Results
We will deliberately change the expected value to the wrong 545111 to see if there will be an error -
regular expression -
expectations are empty
Finally: In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free 【保证100%免费】
Software Testing Interview Documentation
We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.