Posts

Showing posts with the label RequestSpecBuilder

Using RequestSpecBuilder in Rest Assured ( Code Reuse )

Image
In the previous post, we studied about how to check response time using Rest Assured. In this post, we would learn about using RequestSpecBuilder in Rest Assured.  You can use the builder to construct a request specification. RequestSpecBuilder is normally used when we have common parameters, Base URI, Base Path between different tests. Let's look at an example without RequestSpecBuilder. Here we are making use of Google Search API that we studied in  Testing GET Requests and their Responses using Rest Assured . import org.testng.annotations.BeforeClass ; import org.testng.annotations.Test ; import io.restassured.RestAssured ; import io.restassured.http.ContentType ; import static io. restassured . RestAssured .*; public class GetStatusCodeTest { @BeforeClass public void setBaseUri () { RestAssured. baseURI = "https://maps.googleapis.com" ; } @Test public void test01 () { given(). param ( "query" , ...

Popular posts from this blog

Using RequestSpecBuilder in Rest Assured ( Code Reuse )