Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Thursday November 10, 2022

Review:
1. Tell Me About Yourself
2. Tell Me About Your Framework
3. Manual Slides/Homework Questions
4. Java OOPs Concept
5. Selenium Suite (WebDriver, Grid, IDE, RC) /
Challenges – Alert, Multi Window Handling, iframe,
dynamic object, etc
6. Cucumber
7. TestNG – Annotations (dependsOnMethods,
priority), Assertions, Crossbrowser testing
8. API (Manual with Postman, Automation with
RestAssured)
9. Java Coding (Coding part- How to reverse the string,
Loops, Bonus hw questions)
10. Manual Database Questions (select, update, etc)

Data Handling (Scenario Outline with Examples table in


Cucumber, Apache POI (excel), DB automation with
JDBC)
Jenkins
API Automation:

First we send a request using API: CRUD operations

API Database (backend)


C – Create Post Insert
R – Read Get Select
U – Update Put/Patch Update
D – Delete Delete Delete/Truncate/Drop

Drop – Remove the whole table including the


structure and data.
Truncate – Keeps the structure of the table but
removes the data
Delete – Removes the data from the specific
row/column

For API, we have to test the response:


We have to test the status codes, the response body,
content headers, etc. We have to use Assertion and
match the expected with the actual.

Send Request  CRUD  Response


Application:
You have to login. You have to send to the database
a username and a password. The database will
match the username and password and it will
validate if you are the correct user. If correct
user/password then it will generate a token in the
API.

When we send the request for login, it is using the


Post Method with a payload and sending to the
database. Then you get the response back with the
token.

Login (Post Method)


Then use Get Method to get all the Products. If
banking application, you check the balance.

Then use the Post Method to post a new item. If


banking application, deposit/withdrawal, make
payment, credit card, zelle payment.

Then use the Put Method to update the existing


item. If banking application, you can update the
address, phone.
Then use the Delete Method to delete the existing
item. If banking application: You apply for a loan.
The loan application, you can delete.
Status code 204, 200 (check the documentation) The
documentation is created by the PO/Developer.
Swaggerhub, Jira Confluence

API with RestAssured

For Interview, you need to know how to describe


how your API Automation works:

You need to specify the domain with


RestAssured.BaseURI

Then request using the RequestSpecification


interface, you have to request the data with
RestAssured class and the given method. Then use
the header method from the RequestSpecification
and specify the header (content-type,
application/json)

If you are trying to post of put, you have to send the


body. For the body you have to create a Map, then
use the JSONObject class to convert the Map data to
the JSONObject. Then you have to use the jsonString
method to convert the object to string.

Then use the jsonString and pass this value in the


request body. Then you will use the request method
and you need to pass 2 parameters (method.variable
like post, get, put, patch, delete, and the path)

Then you have to store that request in the Response


by creating a response variable. From this response,
you can use different methods like jsonPath to
extract the value of a key in the json body.

How to get the value of a specific key from json?

Or They give you a scenario.


Let’s say your application is weather. This application
responds back with a json body and have this json
body has the following key, value pairs. How do you
find the value of the city?
{
“city” : “Phoenix”,
“zipcode” : 11372,
“degrees” : 30
}
RestAssured.baseURI = domain;
RequestSpecification req =
RestAssured.given();
req.header("Content-Type",
"application/json");

Map data = new LinkedHashMap ();


data.put("city", "Phoenix");
data.put("zipcode",11372);
data.put("degrees",30);
JSONObject obj = new
JSONObject(data);
String json = obj.toJSONString();
response.jsonPath().get("city");

Can you verify the status is 200?

response.then().statusCode(200);

Can you verify the response time is less than 500


ms?

response.then().assertThat().time(Matche
rs.lessThan(500));

pseudo code. You code does not have to be exact


when you type in the notepad.

You might also like