Service Level Agreement
Use Limits
Privacy Policy
Data Processing And Security Agreement
import http from 'pts/http';import { check, sleep } from 'pts';
const globalVar = "var"const globalObj = {"k": "v",}export default function () {console.log(globalVar); // varconsole.log(globalObj.k); // v};
export const option = {http: {http2: true,maxIdleConns: 50,basicAuth: {username: 'user',password: 'passwd',}},tlsConfig: {'localhost': {insecureSkipVerify: false,//Users need to upload the request file ca.crt in the scenario.rootCAs: [open('ca.crt')],//Users need to upload the request files client.crt and client.key in the scenario.certificates: [{cert: open('client.crt'), key: open('client.key')}]}}}
// Global variable, which is defined outside the function.const global = { stage: "global" };// Use the setup function for preprocessing to return custom key-value pairs.export function setup() {return { stage: "setup" };}// Main function (input parameters can receive key-value pairs returned by the setup function).export default function(data) {console.log(JSON.stringify(global)); // {"stage":"global"}console.log(JSON.stringify(data)); // {"stage":"setup"}}// Use the teardown function for post-processing.export function teardown(data) {console.log(JSON.stringify(global)); // {"stage":"global"}console.log(JSON.stringify(data)); // {"stage":"setup"}}
import http from 'pts/http';import { check } from 'pts';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');}

フィードバック