i have been successful in capturing api response time using restassured .time() method and but i noticed that the response time returned in restassured is slightly higher than the same request if sent using postman or soapui. i looked everywhere on why restassured is taking too long but didnt find any answers, i also looked on how to reduce the restassured overhead thinking that may be the cause but also no success finding that up. please any suggestions may help here to find why response time in restassured is higher comparing to other tools
this is my restassured call and i tried all the time functions in restassured to compare
Response Response = given().contentType(MediaType.TEXT_XML).accept(MediaType.TEXT_XML).body(content).log().all()
.when().post("https://myurl.com").then().log().all()
.extract().response();
logger.info(Response.getTime());
logger.info(Response.getTimeIn(TimeUnit.SECONDS));
logger.info(Response.time());
logger.info(Response.timeIn(TimeUnit.MILLISECONDS));
As indicated by the docs the value is not precise, especially when the JVM is cold. You should regard the time measurement as an approximation rather than fact. For example it can be useful to track statistics (on a CI server) over longer periods of time to find deviations such as sudden spikes related to a specific commit. The reason why you should not regard this as a precise measurement is because REST Assured's response time measurement includes a lot of processing such JVM/Groovy class load times. You should probably using something like JMH if you really want to get proper benchmarks.