API, SQL, AUTOMATION Flashcards
WHAT IS POSTMAN
POSTMAN IS A TOOL THAT YOU CAN USE TO TEST YOUR OWN OR EXTERNAL REST API’S
WHAT IS REST API
REST APIs use standard HTTP methods to perform CRUD (Create, Read, Update, Delete) operations
GET: Retrieve information about a resource.
POST: Create a new resource.
PUT: Update an existing resource.
DELETE: Remove a resource.
HOW DO YOU MAKE A POST IN POSTMAN
A POST IS MADE IN JSON FORMAT. INSIDE CURLY BRACKETS YOU WRITE THE VALUES AND NAMES INSIDE DOUBLE QUOTES AND ADD A COMMA AFTER EVERY ENTRY
WHAT IS A 405 STATUS
A 405 status code, also known as “Method Not Allowed,” is an HTTP response status code indicating that the request method is known by the server but has been disabled and cannot be used for the requested resource
WHAT IS A 200 STATUS
A 200 status code, known as “OK,” is an HTTP response status code indicating that the request has succeeded
WHAT IS A 400 STATUS
A 400 status code, known as “Bad Request,” is an HTTP response status code indicating that the server could not understand the request due to invalid syntax
WHAT IS A WAY TO CHECK PERFORMANCE WITH POSTMAN
ONE WAY TO CHECK PERFORMANCE IN POSTMAN IS BY CHECKING THE RESPONSE TIME OF A REQUEST.
TELL US ABOUT A BUG YOU FOUND THAT YOU WERE PROUD OF
The Bug
During one of my exploratory testing sessions, I discovered an issue where applying multiple discount codes in a specific sequence would incorrectly calculate the total discount, leading to a significantly higher discount than intended. This was a major issue because it could result in substantial financial losses and affect the integrity of our pricing model.
Discovery Process
To pinpoint the problem, I began by reproducing the bug consistently in a controlled environment. I meticulously documented each step and noted that the issue occurred only when certain types of discount codes were combined. I then used debugging tools to trace the application’s behavior and discovered that the discount calculation algorithm had a flaw when handling overlapping discount rules.
Resolution
I documented the bug in our tracking system with detailed steps to reproduce, screenshots, and logs. I then collaborated with the development team to provide additional insights from my testing. Together, we modified the discount calculation logic to ensure that it accurately applied discounts without overlap. I also designed and implemented new test cases to cover various combinations of discount codes to prevent similar issues in the future.
WHAT ARE SOME THINGS YOU TEST IN POSTMAN
ONE THING TO TEST IS THE PERFORMANCE. YOU CAN SIMPLY DOING THIS IN POSTMAN BY CHECKING THE RESPONSE TIME OF A REQUEST. ANOTHER THING WE CAN TEST IS TO SEE IF THE JSON DATA MATCHES A REQUEST SIMPLY BY CHECKING FOR INSTANCE IF LETS SAY YOU WANT TO CHECK A PAGE NUMBER YOU’D DO SOMETHING LIKE JSONDATA.PAGE TO EQ AND THEN THE NUMBER IT ITS SUPPOSED TO BE
Validation testting
functional testing
What kinds of bugs that API testing would often find?
Missing or duplicate functionality
Fails to handle error conditions gracefully
Stress
Reliability
Security
Unused flags
Not implemented errors
Inconsistent error handling
Performance
Multi-threading issues
Improper errors
Give me an example of how you test api at your current company
Recently, we introduced a new Order Management API to handle order creation, updates, and cancellations.
Create Order: I tested the POST /orders endpoint with valid order data and verified that the API returned a 201 Created status with the correct order details in the response. I also tested edge cases, such as placing orders with maximum allowed items.
Update Order: I tested the PUT /orders/{orderId} endpoint to update order details, ensuring that only valid updates were accepted and reflected correctly in the database.
Cancel Order: I tested the DELETE /orders/{orderId} endpoint to ensure that orders could be canceled and appropriate status codes (e.g., 204 No Content) were returned.
WHAT IS SQL
SQL OR STRUCTURED QUERY LANGUAGE IS A MANAGEMENT LANGUAGE USED TO COMMUNICATE WITH A DATABASE. IT IS USED FOR QUERYING, UPDATING, AND MANAGING DATA.
WHY DO WE USE SQL IN TESTING
WELL LETS SAY YOUR APPLICATION HAS A SIGN UP PAGE, EVERY PERSON WHO SIGNS UP USING THE PROVIDED FIELDS WILL BE ADDED TO A DATABASE. WELL US AS TESTERS WOULD NEED TO GO INTO THE DATABASE AND MAKE SURE ALL THOSE FIELDS ARE ADDED CORRECTLY AND WE CAN DO THAT BY LOOKING FOR A USER, AND THEN OK FIRST NAME IS IN THE CORRECT FIELD, LAST NAME IS TOO, AND EMAIL.
TELL US HOW YOU USE SQL AT YOUR CURRENT COMPANY
One of my key responsibilities is to validate that the order processing system is working correctly. This involves verifying that orders are accurately recorded in the database and that all related data is consistent.
Validating New Orders
When a new order is placed, I use SQL to ensure that the order details are correctly stored in the orders table.
After an order is placed, the inventory for the ordered products should be updated. I verify this by querying the inventory table.
Customer Order History
To ensure that a customer’s order history is accurately maintained, I query the customer_orders view.
WHAT IS THE DIFFERENCE BETWEEN A PRIMARY KEY AND A FOREIGN KEY
Primary Key:
Uniquely identifies each record in a table.
Must contain unique values.
Cannot contain NULL values.
Ensures each record is unique and can be identified.
Foreign Key:
Establishes a relationship between two tables.
Values must match values in the referenced primary key column.
Can contain NULL values (depending on the design).
Ensures referential integrity between tables.