Reputation: 31
Unable to get the response time in rest assured? I have used the getTime() method but didn't help
Upvotes: 0
Views: 1823
Reputation: 1980
In this code snippet you can define the time unit as well.
long actualTimeWithUnits=given().get("https://restcountries.eu/rest/v2/currency/cop").getTimeIn(TimeUnit.SECONDS);
Upvotes: 1
Reputation: 2542
I do not know which RestAssured
version you are using, but starting with 2.8.0
and greater you have a rather simple approach by using the getTime
method on the Response
object.
So just try the following and please verify that it is working for you:
long millis = RestAssured.get("http://google.de").time()
Further details about time measuring and the use of time constraints in assertions can also be found in the respective part of the RestAssured docs.
If you're still on an older version than 2.8.0
, consider upgrading, it is really worth it!
Upvotes: 1