Release Notes
export const option = {...}) at the outermost layer of the script, and define fields, such as tlsConfig and http in the option object based on your needs.http field in option, you can configure relevant parameters for the performance testing engine as an HTTP client. These parameters take effect globally for all HTTP requests in this performance testing task.headers: Request header.basicAuth: When using HTTP basic authentication, pass in the username and password through this parameter.disableKeepAlives: To disable persistent connection, set this field to true.discardResponseBody: To discard the response body returned by the server, set this field to true.http2: To enable HTTP/2, set this field to true.maxIdleConns: Maximum number of connections per VU. The default value is 100.maxIdleConnsPerHost: Maximum number of connections per VU for a single host (address + port). The default value is 2.maxRedirects: Maximum number of redirects. The default value is 10.timeout: Request timeout interval, in milliseconds. The default value is 10000 (10 seconds).import http from 'pts/http';import { check } from 'pts';export const option = {http: {maxRedirects: 10,maxIdleConns: 100,headers: {'key': 'value'}}}export default function () {// get request with headers and parametersconst resp1 = http.get('http://httpbin.org/get', {headers: {Connection: 'keep-alive','User-Agent': 'pts-engine',},query: {name1: 'value1',name2: 'value2',},});console.log(resp1.json().args.name1); // 'value1'check('status is 200', () => resp1.statusCode === 200);check('body.args.name1 equals value1', () => resp1.json().args.name1 === 'value1');check('headers.key equals value', () => resp1.json().headers.key === 'value')}
ws field in option, you can configure relevant parameters for the performance testing engine as a WebSocket client. These parameters take effect globally for all WebSocket requests in this performance testing task.handshakeTimeout: Handshake timeout interval, in milliseconds. The default value is 30 seconds.readTimeout: Timeout interval for reading messages, in milliseconds. It is not limited by default.writeControlTimeout: Timeout interval for writing control instructions, in milliseconds. The default value is 10 seconds.writeTimeout: Timeout interval for writing messages, in milliseconds. It is not limited by default.export const option = {ws: {writeTimeout: 3000,readTimeout: 3000,}}
insecureSkipVerify: Whether to verify the certificate chain and hostname of the server. If it is set to true, no validation will be performed (the default value is false).rootCAs: A set of root certificate authorities used when verifying server certificates. If it is left empty, the root CA set of the host will be used by default.certificates: A list of certificates provided by the client for server verification in mutual TLS authentication (certificate files can be uploaded through File Management > Request File in the scenario).export const option = {tlsConfig: {'localhost': {insecureSkipVerify: false,rootCAs: [open('ca.crt')],certificates: [{cert: open('client.crt'), key: open('client.key')}]}}}
export const option = { setupTimeoutSeconds: 30 }
teardownTimeoutSeconds: Timeout interval for the post-processing (teardown) step. The default value is 60 seconds.export const option = {teardownTimeoutSeconds: 30}
피드백