Parameter | Type | Description |
name | string | The name of the checkpoint. |
callback | function | The function used for check, which should return a boolean type. |
response (optional) | Pass in the response of the request being checked to enable recording of the checkpoint logs. |
Type | Description |
boolean | The result of the check. true indicates the check passed, and false indicates the check failed. |
import http from 'pts/http';import { check } from 'pts';export default function () {const resp = http.get('http://mockhttpbin.pts.svc.cluster.local/get');check('statusCode is 200', () => resp.statusCode === 200); // Set a checkpoint to collect statistics on checkpoint metrics.check('statusCode is 200', () => resp.statusCode === 200, resp); // Set a checkpoint to collect statistics on checkpoint metrics and record checkpoint logs.};
Feedback