接口性能测试
代码编写思路:!、加挂研发代码jar包
2、获取请求体参数名称并赋值
3、调用研发代码请求方法
4、添加请求头
5、添加请求体
String phone = lr.eval_string("<NewParam>");
String smsContent = "Welcome to Hexin Short Message Group Chat developed by China Mobile";
String conversationId = lr.eval_string("<phone>");
String appId = "csmsa.cmcc.template.sms";
String msgSeqId = lr.eval_int("<msgSeqId>")+"";
String shareKey = "csmsa.cmcc.template.sms";
String srcid = lr.eval_string("<srcid>");
String templateId = "cmcc.template.sms.none";
String templateVersion = "1.0.0";
String replyReference = "http://xx.xx.xx.xx:xxxx/test/submit";
InitializeClass initializeClass = new InitializeClass();
Submit submitData = initializeClass.getSubmitData(new String[]{"http://test.com",
appId,msgSeqId,shareKey,
"12520009"+srcid,smsContent,
"extmsgid","group.invite",templateId,templateVersion,
replyReference ,conversationId,
"1","+861340210"+phone});
//SubmitHeader header = new SubmitHeader();
SubmitHeader header = submitData.getSubmitHeader();
String token = header.getToken();
String timestamp = header.getTimestamp();
web.add_header("appid",appId);
web.add_header("timestamp",timestamp);
web.add_header("msgSeqId",msgSeqId);
web.add_header("token",token);
web.add_header("Content-Type","application/json;charset=utf-8");
lr.rendezvous("submitData");
lr.start_transaction("事物开始");
web.custom_request("preview",
"Method=POST",
new String[]{
"URL=http://xx.xxx.xx.xx:xxxx/sms/submit",
"Body="+submitData.getBody(),
"TargetFrame=",
"RecContentType=application/json",
"LAST"});
lr.end_transaction("事物开始", lr.AUTO); 不错。。
页:
[1]