LR http interface test template
Lr directly clicks to create the script, and then write the code in action.
The specific script is as follows:
Action ()
{
Int status
Lr_start_transaction ("send")
Web_reg_find ("Search=All", / / the setting of checkpoint function
"SaveCount=ret_Count", / / the name saved by the parameter to be found
"Text=ahbei"
LAST)
Status=web_url ("usermsg"
"URL= http://bubbler.labs.douban.com/j/user/ahbei", / / Interface to be tested
"TargetFrame=Main"
"Resource=0"
"RecContentType=text/html"
"Mode=http"
LAST)
Lr_output_message ("Request Status:%d", status)
Lr_output_message ("number of returned values found:% d", atoi (lr_eval_string ("{ret_Count}")
If (atoi (lr_eval_string ("{ret_Count}")) > 0) {/ / the number of checks is determined here
Lr_output_message ("Rec successful.")
Lr_end_transaction ("send", LR_PASS)
}
Else {
Lr_error_message ("Rec failed")
Lr_end_transaction ("send", LR_FAIL)
}
Return 0
}