To Check Response Time using Rest Assured

In the previous post, we studied about automating delete request using Rest Assured. In this post, we will learn about checking the response time of REST API. I would highly recommend to read previous tutorials before reading this one. Response Time is nothing but the total time taken to get REST API response. Let's look at the example to check the response time of API installed on our local system using Rest Assured. import org.testng.annotations.BeforeClass ; import org.testng.annotations.Test ; import io.restassured.RestAssured ; import static io. restassured . RestAssured .*; import static org. hamcrest . Matchers . lessThan ; public class VerifyResponseTime { @BeforeClass public void setBaseUri () { RestAssured. baseURI = "http://localhost:3000" ; } @Test public void responseTime () { given() . when () . get ( "/posts" ) . then () . time (lessThan ( 10 l)); } } In the setBaseUri ...