LoadRunner don't know why there's such a big volume.
Started with a C script, but the disgusting is not a complete C, read the file fseek incredibly not.
Then toss Java script, found that loadrunner11 Java to use JDK 1.6 and is 32-bit, and finally started.
The syntax is perfect for Java.
Import the package that comes with LoadRunner first.
Import LRAPI.LR;
Import Lrapi.web;
Logical code is just like normal Java, very handy.
Web.reg_save_param Save the data returned by the request, the first parameter is equivalent to the saved variable, and the second is the filter condition.
We're going back to JSON, which can parse the JSON directly through a third-party library, but only some of the fields in JSON, the JSON parsing, is a bit of a hassle.
"lb=version\": "," rb=, ", LB represents the beginning of the search, which is represented here from version": Start looking, RB means end, leave blank for the end, quotation marks "to be escaped with," last "represents the closing tag.
Remove the saved value with lr.eval_string ("<ResponseBody>").
Web.reg_save_param ("Responsebody",Newstring[]{"lb=version\": "," rb=, "," Search=body "," Last "}); String HtmlBody= "Body=loadtest=1¶m={\" userid\ ": 1790}"; Try{web.custom_request ("Apply/check", This. Reqtype,Newstring[]{"Url=http://192.168.18.227/apply/check", "Method=post", HtmlBody,//String Object is not in quotes"Last"}); String result= Lr.eval_string ("<ResponseBody>"); returnresult; } Catch(Exception e) {return""; }
For the C language version, the LR. or Web. Prefix is changed to Lr_ or web_
LOADRUNNER11 Testing RESTful