1. What is RestAssured?
It is a Java-based library that is used to test RESTApis.
2. How to add RestAssured in your project which is based on Maven?
Add as a maven dependency in the pom.xml file
3. What is command chaining when it comes to the RestAssured?
We can use each command one after another as below that is called command chaining
given().when().then()….
4. How to add query parameters in a request?
given().queryParam(“name”, “Alice”)
5. How to perform authentication in RestAssured?
given().auth().basic(“id”)
6. Can we use the page object model when writing rest-assured scripts?
Yes. We can move repeating steps into page objects.
7. What can be verified using RestAssured in API testing?
- API response
- status code
- headers
- response time
8. What is the best way to create a JSON body using RestAssured?
Use fluent builder pattern. Use Jackson data binding maven dependency into the pom.xml file. Create a String object as the payload of the request.
9. Can you use the JSON file as a payload in a POST request?
Yes. Create a JSON file and keep it under the resources folder. Then give the file name inside the body() method.
No comments:
Post a Comment