Which property is used to read the response time of API? code example

Example 1: postman test script get request code

tests["Status code is 200"] = responseCode.code === 200;
//log
console.log(tests["Status code is 200"] = responseCode.code != 200)

Example 2: testing time in response body

Response time is the amount of time
 a system takes to react to a request
 when they received one.
Basically this is Remote Response time.
 
 
If file not under resources: 
File schemaFile = new File("src/test/resources/postSuccessResponseSchema.json");

     given()
        .spec(adminReqSpec)
        .contentType(ContentType.JSON)
        .body(abcUtil.getRandomHeroPOJO_Payload()).
     when()
        .post("/HEROS").
     then()
        .body(matchesJsonSchema( schemaFile )  ) 
        
        
If schema file under resources:
  given()
      .spec(adminReqSpec)
      .queryParam("nameContains","a")
      .queryParam("gender","Female").
  when()
      .get("/abc/search").
 then()
 	  .time( lessThan(2000L));	
      .body(matchesJsonSchemaInClasspath("searchSpartanSchema.json") )

Tags:

Misc Example