我的以下k6脚本可以正常使用1个vuser。但是每当我使用超过1个vuser运行时,脚本都会失败: -
(←[33mWARN←[0m [0114]请求失败←[33merror←[0m ="发布http://myurl.mycompany.com/v1/Order:net / http:请求已取消(在等待标题时超出了Client.Timeout)&# 34)。
见下面的脚本。任何帮助将不胜感激。
// Auto-generated by the Load Impact converter
import http from "k6/http";
import { check, group, sleep} from "k6";
export let options = {
vus: 2,
duration: "120s",
// maxRedirects: 4
}
export default function() {
let res;
res = http.post("http://myurl.mycompany.com.com/v1/Order",
"{ \"orderNumber\": \"\", \"webConfirmationId\": 12345, \"opptunityNum\": \"201707-861215\", \"accountNumber\": \"GNUF4240\", \"CustomerInstructions\": \"\", \"internalComments\": [ { \"text\": \"Client Contact: John D johnd@mycompany.com 2125555555 \" } ], \"OrderContact\": \"\", \"SalesForceContactId\": \"\", \"ancillaryItems\": [ { \"ancillaryItemTypeCode\": \"DISCOUNT\", \"description\": \"2% Web Discount\", \"unitPrice\": -4.99, \"quantity\": 1.0 } ], \"billToAddress\": {}, \"CampaignNumber\": \"ZXYCR\", \"ChargeLogicReferenceNumber\": \"\", \"createDate\": \"2017-07-26T20:19:54.587Z\", \"CON\": \"\", \"orderTypeCode\": \"4XD\" }",
{ headers: { "Authorization" : "bearer jahhHodoUVVTKqhsypd_tWbcsk", "Content-Type" : "application/json" } });
check(res, {
"is status 200":(r)=>r.status===200
});
sleep(3);
}
答案 0 :(得分:0)
由于它是POST请求,因此响应代码应为201,因为它是创建动作,