0

我的以下 k6 脚本在 1 个 vuser 下运行良好。但是,每当我使用超过 1 个 vuser 运行时,脚本都会失败:-

(←[33mWARN←[0m[0114] 请求失败 ←[33merror←[0m="Post http://myurl.mycompany.com/v1/Order : net/http: 请求已取消(等待标头时超出 Client.Timeout) ”)。

请参阅下面的脚本。任何帮助将不胜感激。

// 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);
}
4

1 回答 1

0

响应代码应该是 201,因为它是一个创建操作,因为它是一个 POST 请求。

于 2019-09-19T12:13:21.877 回答