51Testing软件测试论坛

标题: 压测接口报错 [打印本页]

作者: wuwuwumiaohong    时间: 2016-1-5 13:39
标题: 压测接口报错
需要做一个压测,代码如下:
Action()
{
//提交答卷
web_custom_request("AddAnswerInfo",
"URL=http://172.20.10.16:9001/Student/AddAnswerInfo",
"Method=POST",
"Resource=0",
"RecContentType=application/json",
"Referer=",
"Mode=HTTP",
"EncType=application/json",

  "Body={\"QuestionID\":\"43\",\"AnswerContent\":\"[{\"id\":\"1084\" ,\"answer\":\"5394\",\"score\":\"1\"},{\"id\":\"1085\" ,\"answer\":\"5397\",\"score\":\"2\"},{\"id\":\"1086\" ,\"answer\":\"5399\",\"score\":\"2\"},{\"id\":\"1087\" ,\"answer\":\"5404\",\"score\":\"4\"},{\"id\":\"1088\" ,\"answer\":\"5411\",\"score\":\"6\"},{\"id\":\"1089\" ,\"answer\":\"5419\",\"score\":\"7\"},{\"id\":\"1090\" ,\"answer\":\"5425\",\"score\":\"7\"},{\"id\":\"1091\" ,\"answer\":\"5430\",\"score\":\"2\"},{\"id\":\"1092\" ,\"answer\":\"5436\",\"score\":\"3\"},{\"id\":\"1093\" ,\"answer\":\"5443\",\"score\":\"5\"},{\"id\":\"1094\" ,\"answer\":\"5445\",\"score\":\"2\"},{\"id\":\"1095\" ,\"answer\":\"5451\",\"score\":\"3\"},{\"id\":\"1096\" ,\"answer\":\"5458\",\"score\":\"5\"},{\"id\":\"1097\" ,\"answer\":\"5460\",\"score\":\"2\"},{\"id\":\"1098\" ,\"answer\":\"5466\",\"score\":\"3\"},{\"id\":\"1099\" ,\"answer\":\"5470\",\"score\":\"2\"},{\"id\":\"1100\" ,\"answer\":\"5478\",\"score\":\"5\"},{\"id\":\"1101\" ,\"answer\":\"5480\",\"score\":\"2\"},{\"id\":\"1102\" ,\"answer\":\"5486\",\"score\":\"3\"},{\"id\":\"1103\" ,\"answer\":\"5490\",\"score\":\"2\"},{\"id\":\"1104\" ,\"answer\":\"5498\",\"score\":\"5\"},{\"id\":\"1105\" ,\"answer\":\"5500\",\"score\":\"2\"},{\"id\":\"1106\" ,\"answer\":\"5507\",\"score\":\"4\"},{\"id\":\"1107\" ,\"answer\":\"5510\",\"score\":\"2\"},{\"id\":\"1108\" ,\"answer\":\"5516\",\"score\":\"3\"},{\"id\":\"1109\" ,\"answer\":\"5519\",\"score\":\"1\"},{\"id\":\"1110\" ,\"answer\":\"5525\",\"score\":\"2\"},{\"id\":\"1111\" ,\"answer\":\"5531\",\"score\":\"3\"},{\"id\":\"1112\" ,\"answer\":\"5538\",\"score\":\"5\"},{\"id\":\"1113\" ,\"answer\":\"5540\",\"score\":\"2\"},{\"id\":\"1114\" ,\"answer\":\"5546\",\"score\":\"3\"},{\"id\":\"1115\" ,\"answer\":\"5550\",\"score\":\"2\"},{\"id\":\"1116\" ,\"answer\":\"5558\",\"score\":\"5\"},{\"id\":\"1117\" ,\"answer\":\"5560\",\"score\":\"2\"},{\"id\":\"1118\" ,\"answer\":\"5566\",\"score\":\"3\"},{\"id\":\"1119\" ,\"answer\":\"5572\",\"score\":\"4\"},{\"id\":\"1120\" ,\"answer\":\"5575\",\"score\":\"2\"},{\"id\":\"1121\" ,\"answer\":\"5583\",\"score\":\"5\"},{\"id\":\"1122\" ,\"answer\":\"5585\",\"score\":\"2\"},{\"id\":\"1123\" ,\"answer\":\"5591\",\"score\":\"3\"},{\"id\":\"1124\" ,\"answer\":\"5595\",\"score\":\"2\"},{\"id\":\"1125\" ,\"answer\":\"5600\",\"score\":\"2\"},{\"id\":\"1126\" ,\"answer\":\"5604\",\"score\":\"1\"},{\"id\":\"1127\" ,\"answer\":\"5611\",\"score\":\"3\"},{\"id\":\"1128\" ,\"answer\":\"5618\",\"score\":\"5\"},{\"id\":\"1129\" ,\"answer\":\"5620\",\"score\":\"2\"},{\"id\":\"1130\" ,\"answer\":\"5626\",\"score\":\"3\"},{\"id\":\"1131\" ,\"answer\":\"5632\",\"score\":\"4\"},{\"id\":\"1132\" ,\"answer\":\"5635\",\"score\":\"2\"},{\"id\":\"1133\" ,\"answer\":\"5639\",\"score\":\"1\"},{\"id\":\"1134\" ,\"answer\":\"5646\",\"score\":\"3\"},{\"id\":\"1135\" ,\"answer\":\"5650\",\"score\":\"2\"},{\"id\":\"1136\" ,\"answer\":\"5656\",\"score\":\"3\"},{\"id\":\"1137\" ,\"answer\":\"5663\",\"score\":\"5\"},{\"id\":\"1138\" ,\"answer\":\"5666\",\"score\":\"3\"},{\"id\":\"1139\" ,\"answer\":\"5670\",\"score\":\"2\"},{\"id\":\"1140\" ,\"answer\":\"5678\",\"score\":\"5\"},{\"id\":\"1141\" ,\"answer\":\"5681\",\"score\":\"3\"},{\"id\":\"1142\" ,\"answer\":\"5687\",\"score\":\"4\"},{\"id\":\"1143\" ,\"answer\":\"5690\",\"score\":\"2\"},{\"id\":\"1144\" ,\"answer\":\"5696\",\"score\":\"3\"},{\"id\":\"1145\" ,\"answer\":\"5703\",\"score\":\"5\"},{\"id\":\"1146\" ,\"answer\":\"5705\",\"score\":\"2\"},{\"id\":\"1147\" ,\"answer\":\"5711\",\"score\":\"3\"},{\"id\":\"1148\" ,\"answer\":\"5718\",\"score\":\"5\"},{\"id\":\"1149\" ,\"answer\":\"5719\",\"score\":\"1\"},{\"id\":\"1150\" ,\"answer\":\"5727\",\"score\":\"4\"},{\"id\":\"1151\" ,\"answer\":\"5731\",\"score\":\"3\"},{\"id\":\"1152\" ,\"answer\":\"5735\",\"score\":\"2\"},{\"id\":\"1153\" ,\"answer\":\"5743\",\"score\":\"5\"},{\"id\":\"1154\" ,\"answer\":\"5746\",\"score\":\"3\"},{\"id\":\"1155\" ,\"answer\":\"5752\",\"score\":\"4\"},{\"id\":\"1156\" ,\"answer\":\"5755\",\"score\":\"2\"},{\"id\":\"1157\" ,\"answer\":\"5763\",\"score\":\"5\"},{\"id\":\"1158\" ,\"answer\":\"5765\",\"score\":\"2\"},{\"id\":\"1159\" ,\"answer\":\"5771\",\"score\":\"3\"},{\"id\":\"1160\" ,\"answer\":\"5778\",\"score\":\"5\"},{\"id\":\"1161\" ,\"answer\":\"5781\",\"score\":\"3\"},{\"id\":\"1162\" ,\"answer\":\"5787\",\"score\":\"4\"},{\"id\":\"1163\" ,\"answer\":\"5790\",\"score\":\"2\"},{\"id\":\"1164\" ,\"answer\":\"5798\",\"score\":\"5\"},{\"id\":\"1165\" ,\"answer\":\"5801\",\"score\":\"3\"},{\"id\":\"1166\" ,\"answer\":\"5805\",\"score\":\"2\"},{\"id\":\"1167\" ,\"answer\":\"5812\",\"score\":\"4\"},{\"id\":\"1168\" ,\"answer\":\"5816\",\"score\":\"3\"},{\"id\":\"1169\" ,\"answer\":\"5823\",\"score\":\"5\"},{\"id\":\"1170\" ,\"answer\":\"5825\",\"score\":\"2\"},{\"id\":\"1171\" ,\"answer\":\"5832\",\"score\":\"4\"},{\"id\":\"1172\" ,\"answer\":\"5836\",\"score\":\"3\"},{\"id\":\"1173\" ,\"answer\":\"5840\",\"score\":\"2\"},{\"id\":\"1174\" ,\"answer\":\"5847\",\"score\":\"4\"},{\"id\":\"1175\" ,\"answer\":\"5851\",\"score\":\"3\"},{\"id\":\"1176\" ,\"answer\":\"5855\",\"score\":\"2\"},{\"id\":\"1177\" ,\"answer\":\"5861\",\"score\":\"3\"},{\"id\":\"1178\" ,\"answer\":\"5868\",\"score\":\"5\"},{\"id\":\"1179\" ,\"answer\":\"5869\",\"score\":\"1\"},{\"id\":\"1180\" ,\"answer\":\"5876\",\"score\":\"3\"},{\"id\":\"1181\" ,\"answer\":\"5880\",\"score\":\"2\"},{\"id\":\"1182\" ,\"answer\":\"5887\",\"score\":\"4\"},{\"id\":\"1183\" ,\"answer\":\"5890\",\"score\":\"2\"},{\"id\":\"1184\" ,\"answer\":\"5898\",\"score\":\"5\"},{\"id\":\"1185\" ,\"answer\":\"5900\",\"score\":\"2\"},{\"id\":\"1186\" ,\"answer\":\"5906\",\"score\":\"3\"},{\"id\":\"1187\" ,\"answer\":\"5910\",\"score\":\"2\"},{\"id\":\"1188\" ,\"answer\":\"5918\",\"score\":\"5\"},{\"id\":\"1189\" ,\"answer\":\"5921\",\"score\":\"3\"},{\"id\":\"1190\" ,\"answer\":\"5928\",\"score\":\"5\"},{\"id\":\"1191\" ,\"answer\":\"5930\",\"score\":\"2\"},{\"id\":\"1192\" ,\"answer\":\"5936\",\"score\":\"3\"},{\"id\":\"1193\" ,\"answer\":\"5940\",\"score\":\"2\"},{\"id\":\"1194\" ,\"answer\":\"5948\",\"score\":\"5\"},{\"id\":\"1195\" ,\"answer\":\"5950\",\"score\":\"2\"},{\"id\":\"1196\" ,\"answer\":\"5957\",\"score\":\"4\"},{\"id\":\"1197\" ,\"answer\":\"5961\",\"score\":\"3\"},{\"id\":\"1198\" ,\"answer\":\"5965\",\"score\":\"2\"},{\"id\":\"1199\" ,\"answer\":\"5973\",\"score\":\"5\"},{\"id\":\"1200\" ,\"answer\":\"5975\",\"score\":\"2\"},{\"id\":\"1201\" ,\"answer\":\"5982\",\"score\":\"4\"},{\"id\":\"1202\" ,\"answer\":\"5985\",\"score\":\"2\"},{\"id\":\"1203\" ,\"answer\":\"5993\",\"score\":\"5\"},{\"id\":\"1204\" ,\"answer\":\"5995\",\"score\":\"2\"},{\"id\":\"1205\" ,\"answer\":\"6001\",\"score\":\"3\"},{\"id\":\"1206\" ,\"answer\":\"6005\",\"score\":\"2\"},{\"id\":\"1207\" ,\"answer\":\"6013\",\"score\":\"5\"},{\"id\":\"1208\" ,\"answer\":\"6016\",\"score\":\"3\"},{\"id\":\"1209\" ,\"answer\":\"6020\",\"score\":\"2\"},{\"id\":\"1210\" ,\"answer\":\"6027\",\"score\":\"4\"},{\"id\":\"1211\" ,\"answer\":\"6031\",\"score\":\"3\"},{\"id\":\"1212\" ,\"answer\":\"6035\",\"score\":\"2\"},{\"id\":\"1213\" ,\"answer\":\"6042\",\"score\":\"4\"},{\"id\":\"1214\" ,\"answer\":\"6048\",\"score\":\"5\"},{\"id\":\"1215\" ,\"answer\":\"6049\",\"score\":\"1\"},{\"id\":\"1216\" ,\"answer\":\"6055\",\"score\":\"2\"},{\"id\":\"1217\" ,\"answer\":\"6061\",\"score\":\"3\"},{\"id\":\"1218\" ,\"answer\":\"6065\",\"score\":\"2\"},{\"id\":\"1219\" ,\"answer\":\"6071\",\"score\":\"3\"},{\"id\":\"1220\" ,\"answer\":\"6074\",\"score\":\"1\"},{\"id\":\"1221\" ,\"answer\":\"6080\",\"score\":\"2\"}]\",\"Score\":\"428\",\"StartDate\":\"2016-01-04 18:00:00.000\"}",

LAST);

     return 0;
}
但是回放日志提示有错误,数据也没有传进去
[attach]99487[/attach]

作者: wohuyuelong    时间: 2016-1-7 22:47
1、确定这个Body是你纯录制的,还是有手工修改什么地方,修改了的话,哪就检查修改的地方
2、问请求开发,是否对同一用户做了唯一性判定,不允许重复提交
作者: rocket911    时间: 2016-1-14 16:42
这个问题我也遇到了后来解决了。感觉是直接在body里写入json报文会有这个问题,我的方法是通过 sprintf(buffer,"%s",报文)先拼装一下,打印一下 查看发送的json是否正确,然后报文有中文字段时转一下UTF-8码,再从body里面发出去就OK了 希望对你有帮助~




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2