Postman test check status from endpoint https://reqres.in/api/users/2 the status response is OK and have status code 200
//Postman test check status is 200 OK pm.test("The endpoint must be give respon code : 200", () => { const expectedStatusCode = 200; pm.response.to.have.status(expectedStatusCode); });Postman test check status from endpoint https://reqres.in/api/users/2 the status not have status code 404 or 500
//Postman test check status untuk mengecek apakah terdapat status code 404 atau 500 pm.test("the endpoint does not return unexpected status code : 404 or 500", () =>{ const unexpectedStatusCodes = [404, 500]; pm.expect(pm.response.code).to.not.be.oneOf( unexpectedStatusCodes, did not expect response status to be one of ${unexpectedStatusCodes} but got ${pm.response.code}. ); });Postman test check status of endpoint https://reqres.in/api/users/2 to check response in the body
//Postman check untuk check respon di body pm.test("Verify value in respon body", function(){ pm.expect(pm.response.text(data)).to.include("name"); pm.expect(pm.response.text(data)).to.include("job"); pm.expect(pm.response.text(data)).to.include("updatedAt"); });Postman test check status of endpoint https://reqres.in/api/users/2 to check expected timeout threshold
//Postman test check status untuk mengetahui respon dalam waktu yang diharapkan pm.test("Response time is expected treshold", () => { const expectedTime = 100; pm.expect(pm.response.responseTime).to.be.lessThan( expectedTime + 1, The endpoint did not respond within ${expectedTime} ms. Respon come in ${pm.response.responseTime} ms ); });
