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
When using Postman for API testing, several aspects of an API’s functionality, performance, and reliability are evaluated. Here are key areas to test:
Functional Testing
GET Requests: Ensure the API retrieves data correctly.
POST Requests: Validate data creation.
PUT/PATCH Requests: Test data updates.
DELETE Requests: Verify data deletion
Response Status Codes
Check for appropriate HTTP status codes (e.g., 200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Internal Server Error).
Performance Testing
Measure response times and ensure they are within acceptable limits.
What kinds of bugs that API testing would often find?
Functional Bugs
Incorrect Data Handling: The API returns incorrect data or fails to process valid inputs correctly.
Incorrect HTTP Methods: Using the wrong method (e.g., GET instead of POST).
Missing or Invalid Parameters: The API does not handle required or optional parameters correctly.
Slow Response Times: The API takes too long to respond.
Error Handling Failures: The API does not return appropriate error codes or messages.
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
Data Validation and Integrity
Purpose: Ensure that the data stored in the database is accurate and consistent with the application’s functionality.
Data Retrieval for Testing Scenarios
Purpose: Extract specific data needed to set up or verify test cases.
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.