QA and Software Testing | 134 questions | 2026
Scenario based QA interview questions
Manual Testing
ExperiencedMost askedScenarioFree with sign-inAnswerHideWalk me through a project on your CV and your testing role in it.
Use a short structure: context, your role, what you did, results, what you learned.
ExperiencedMost askedScenarioFree with sign-inAnswerHideA critical bug is found one day before release. What do you do?
- Reproduce the bug and collect evidence. Check the impact: who is affected, how often, is there a workaround, is there data loss or a security risk.
- Tell the product owner, dev lead and release manager right away. Do not only write it in the ticket.
- Show the options: fix and retest, release with a workaround...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you plan testing for a large e-commerce site?
Start with risk and scope:
- Analyse: key flows (browse, search, product, cart, checkout, payment, orders, returns), integrations (payment gateway, shipping, email), and expected traffic.
- Strategy: functional, API, compatibility (browsers, mobile), performance (sale peaks), security (auth, payments),...
FresherMost askedScenarioFree with sign-inAnswerHideHow do you automate a login flow with Playwright and what do you assert?
Open the page, fill in the credentials with locators based on what the user sees, and submit. Then assert the result. Do not just click and stop.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you build a test automation framework from scratch?
Steps:
- Choose a stack that fits the team and the app. For example Playwright or Selenium, a test runner (Playwright Test, pytest, TestNG), reporting (Allure or HTML) and an assertion library.
- Structure: tests, page objects, fixtures and helpers, test data, config per environment, and utilities (API...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you design a performance test with JMeter and which metrics do you report?
- Set goals and workload from real data: key transactions, user count, think time, ramp-up, duration and SLAs (for example p95 under 2 seconds).
- Build a test plan: Thread Group, HTTP Request samplers, config elements (headers, cookies, CSV data), timers, assertions, and correlation for dynamic tokens.
- Run in non-GUI mode, in an environment like production, with separate load generators.
- At the same time, watch server CPU, memory, database and connections.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhat are unstable tests (tests that pass sometimes and fail other times) and how do you deal with them?
An unstable test passes and fails on the same code. Common causes: timing and hard waits, shared or leftover test data, and tests that depend on order. Others are an unstable environment, async UI, and calls to third-party services.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test when requirements are missing or unclear?
- Ask: talk to the product owner, BA and developers. Clear up doubts and write down your assumptions
- Learn from similar features, current behavior, competitor products and user stories
- Use exploratory testing with charters. Test against common sense, standards and consistency
- Draft test scenarios and share them for review, so gaps show up
- Log questions as defects or notes against the requirement
- Confirm your findings and update the documents afterward
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhat would you do if a developer rejects your bug saying it is not a defect?
Stay factual and keep it non-personal. Read the requirement or acceptance criteria again. Check the steps again on the latest build. Share evidence (steps, logs, video) and talk in person or on a quick call. If you still disagree, ask the product owner or BA to decide the expected behavior. If it turns out to be as designed, update the test case. Also ask whether the requirement or UX should change. The aim is the right product, not winning the argument.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhat do you do when you cannot finish all the planned testing before the deadline?
Reprioritize by risk. Run critical-path and high-impact tests first. Drop or delay low-risk ones. Tell stakeholders early, with numbers (tests run, tests left, open defects) and the risk of what stays untested. Ask for help or more time. Automate where you can, and use exploratory sessions on high-risk areas. Write down the untested scope and get clear acceptance of the risk. Never quietly mark tests as passed.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you decide whether a release is ready? What goes into QA sign-off?
Sign-off is a risk decision based on evidence, not a feeling:
- Planned test cases are run, with the pass rate and any blocked tests explained
- No open critical or high-severity bugs. Remaining medium and low bugs are reviewed and accepted
- Regression and smoke suites pass on the release candidate
- Non-functional checks are done (performance, security basics) where in scope
- UAT is approved
- Rollback plan and monitoring are ready
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test a third-party integration end to end (payment gateway, shipping, EDI)?
- Read the integration contract: endpoints, message formats, auth, error codes, retry rules.
- Use the vendor sandbox with test credentials. Mock or stub the dependency for unit and API tests, so they are fast and give the same result every time.
- Test the happy path, declined cases and timeouts. Test duplicate...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you use AI to triage bugs and draft bug reports?
Give the tool cleaned inputs: raw notes, error logs, stack traces and the failing test output. Ask it to do four things. (1) Draft a title, steps, expected result and actual result. (2) Group similar failures and spot likely duplicates. (3) Suggest the likely component and severity. (4) Shorten a long log to the first failing line and the probable cause.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you mentor junior testers and onboard them?
Give a clear start: a product walkthrough, access to environments, a glossary and a buddy. Begin with small, real tasks (retest bugs, run regression, write cases for a simple story). Review their work and give specific feedback. Then widen the scope to exploratory sessions and API tests. Pair with them on a first bug report and a first automation script. Share checklists and templates. Encourage questions. Hold a weekly one-to-one on growth goals. Praise good catches in public.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you handle a blocker bug that stops you from testing?
A blocker stops further testing of a feature or build. For example, login is broken, so no other flow can be reached. Report it right away with high priority. Tell the developer and the lead directly. Mark dependent test cases as Blocked, not failed. Meanwhile, test other areas that are not affected. Once it is fixed, retest it and continue with the blocked cases.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you introduce and drive the adoption of AI tools in a QA team?
I would start small, measure the benefit and keep humans responsible for quality.
Test Case Writing
FresherMost askedScenarioAnswerHideWrite test cases for a login page.
Positive
- A valid email and password logs in and opens the dashboard
- "Remember me" keeps the session after the browser restarts
- The Enter key submits the form
- Email is not case-sensitive (
[email protected]works)
Negative
- Wrong password or unknown email: show one general error ("Invalid email or password"). Do not say which one is wrong
- Empty email, empty password, or both empty: show a message at each field
- Wrong email format (
abc@, no@) - Spaces at the start or end, very long input, SQL or script characters: handled safely
- Account locked or disabled after N failed attempts
Edge and non-functional
- Password is hidden, no autocomplete leak, paste is allowed
- HTTPS only, and the password is never in the URL
- The Back button after logout does not show private pages
- Works on Chrome, Safari and mobile; tab order and screen reader labels are correct
- Response time is under 2 seconds
What they are checking: A clear plan with positive, negative, edge and security cases
ExperiencedMost askedScenarioAnswerHideWrite test cases for a signup (registration) form.
Assume these fields: name, email, password, confirm password, terms checkbox.
Positive
- Valid data creates the account and sends a verification email
- The verification link turns the account on
Negative and validation
- Each required field left empty
- Wrong email formats; an email that is already registered (show a clear message, but follow the policy on not revealing which emails exist)
- Password shorter than the minimum, or missing an uppercase letter, number or symbol that the rules need
- Confirm password does not match
- Terms box not ticked: submit is blocked
- Name with digits, emoji or very long input
Boundary
- Password at exactly the minimum length, and one less; at the maximum length, and one more
- Name with 1 character, and with the maximum length
Other
- Double click on Submit creates only one account
- Expired or already used verification link
- Password is stored as a hash (check the database) and is not in the logs
What they are checking: Field-level validation and boundary thinking
ExperiencedMost askedScenarioAnswerHideWrite test cases for a search feature.
Positive
- An exact keyword returns the right results; a partial keyword works (if the product supports it)
- Search is not case-sensitive; multiple words work; the best matches come first
- Result count and pagination are correct; clicking a result opens the right item
- Suggestions (autocomplete) show while typing
Negative
- Empty search or only spaces: show a message or do nothing
- No match: show a friendly "no results" page with suggestions
- Special characters, quotes,
%,<script>, SQL pieces: no error and no injection - Very long text (1,000 characters)
Other
- Filters and sorting work together with search; the URL can be shared
- Search with a typo or accented letters
- Performance: results come in under 2 seconds for a large catalog
- Recent searches, a clear button, and the "Search" key on a mobile keyboard
What they are checking: Covers both normal use and hard cases
ExperiencedMost askedScenarioAnswerHideWrite test cases for a shopping cart.
- Add one item; adding the same item again raises the quantity (or adds a second line, as the spec says)
- Change the quantity: 1, the maximum allowed, 0 (removes the item), negative, decimal, not a number
- Remove an item; an empty cart shows a message and checkout is disabled
- Price math: line total, subtotal, tax, shipping and discount, rounded to 2 decimals
- Item goes out of stock or stock drops after adding: show a warning at the cart or checkout
- Price changed since the item was added: the cart shows the latest price
- The cart stays after a refresh, after logout and login, and across devices for logged-in users
- A guest cart joins the account cart after login
- Apply a valid, expired and invalid coupon; a coupon used with sale items
- Update the cart in two tabs at the same time
- Mobile layout and quantity buttons
What they are checking: Thinking about business rules and calculations
ExperiencedMost askedScenarioAnswerHideWrite test cases for the checkout flow of an online store.
Flow: cart -> address -> shipping -> payment -> review -> confirmation.
- Happy path as a guest and as a logged-in user; order number and confirmation email
- Address checks: required fields, postcode format, saved addresses, different billing and shipping address
- Shipping options change the total and the delivery estimate
- The order summary matches the cart (items, tax, discount, shipping)
- Payment methods: card, wallet, cash on delivery
- Back button or refresh in the middle of checkout keeps the data and does not create a second order
- Double click on "Place order" creates one order
- Stock drops to zero during checkout: show a clear error and do not charge
- Session expires on the payment page
- The order shows in "My orders", stock goes down, and the invoice is correct
- Failure paths: payment declined, gateway timeout, email service down
What they are checking: The full flow from start to end, with failures handled
ExperiencedMost askedScenarioAnswerHideWrite test cases for a payment page (card payment).
Positive
- Valid card, expiry and CVV: payment succeeds, and the receipt and status update
- Different card types (Visa, Mastercard) are found from the number
Negative
- Wrong card number (fails the Luhn check), expired card, wrong CVV length, past expiry date
- Not enough money, card declined, 3-D Secure failed or cancelled
- Empty fields, letters in number fields
Edge
- Gateway timeout: the user is not charged twice, and the order stays "pending" until it is checked against the bank record
- Double click or refresh after submit: the request is idempotent (running it twice gives the same result), so there is one charge
- Amount and currency sent to the gateway match the order
- Browser Back after success does not send the payment again
Security
- Card details are not logged or stored, the page uses HTTPS, the CVV is hidden
- Changing the amount in the request is rejected on the server
What they are checking: Handling money safely, idempotency and security
ExperiencedMost askedScenarioAnswerHideWrite test cases for a file upload feature.
Positive
- Upload allowed types (jpg, png, pdf) within the size limit; preview and download work
- Many files, drag and drop, replace a file and delete a file
Negative
- Types that are not allowed, a renamed extension (
.exerenamed to.jpg), a file with zero bytes - A file 1 byte over the limit, and a file exactly at the limit
- A very long file name or one with special characters; the same name twice
- Cancel the upload half way, network drops, resume or retry
Security
- Files with harmful content, a script inside an SVG, path traversal in the file name (
../../x): all rejected - File links cannot be guessed; downloads need permission
Other
- Progress bar and error messages
- Upload on a slow network; upload from a mobile camera; a large file does not freeze the screen
What they are checking: Limits, checks and security of uploads
FresherMost askedScenarioAnswerHideWrite test cases for an ATM machine.
Authentication
- A valid card and PIN opens the menu
- Wrong PIN once, twice and three times: the card is blocked or kept after the limit
- An expired, damaged or non-bank card is rejected; the card is removed during a transaction
Withdrawal
- Amount that fits the available notes, is within the balance and is within the daily limit
- Amount above the balance, above the daily limit, not a multiple of the note value, zero, or negative
- The machine does not have enough cash
- The receipt is printed with the right details; the balance goes down only once
Other functions
- Balance check, mini statement, PIN change, deposit, transfer
- Timeout when no one uses it: the card is returned
- Power or network failure during a withdrawal: the transaction is reversed and no money is lost
- Cancel at any step; privacy (PIN is hidden); access for people with poor sight
What they are checking: Testing a real-world device, including failures
FresherMost askedScenarioAnswerHideWrite test cases for a to-do list application.
Add
- Add a task with valid text; the Enter key and the Add button both work
- An empty task or a task with only spaces is rejected
- Very long text, emojis, HTML tags (shown safely), duplicate names
Complete, edit and delete
- Mark a task done and undo it; the strike-through and the counter update
- Edit the text, cancel the edit, save an empty edit
- Delete a task, ask for confirmation, undo if the app has it
- Clear completed tasks
List behavior
- The filters All / Active / Completed show the right items
- Task order, drag to reorder, priority and due date if present
- Tasks stay after a refresh and show in another tab (local storage or server)
- 500+ items still run well
Other
- Keyboard use, mobile layout, text direction, page title and counters
What they are checking: The whole create, read, update, delete flow plus saved data
FresherMost askedScenarioAnswerHideWrite test cases for a forgot password / password reset flow.
Positive
- A registered email gets a reset link; the link opens the reset form; the new password works; the old password stops working
- The user is logged out of other sessions after the reset
Negative
- Unknown email: show the same neutral message ("If an account exists...") so no one can find out which emails exist
- Expired link (for example after 15 minutes), a link that was already used, a changed token
- New password breaks the rules; confirm password does not match; same as the old password, if that is blocked
- Many requests in a row: the system limits them
Security
- The token is random, works once, and cannot be guessed; the link uses HTTPS
- The email does not contain the password; the reset does not show account details
Other
- The email arrives in a reasonable time, with the right branding and link
- Two reset requests: only the latest link is valid
What they are checking: Testing a flow with security in mind
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for OTP verification.
- Positive: the correct OTP within its valid time (for example 5 minutes) completes the login
- Wrong OTP: an error shows, attempts are counted, and the user is locked out after the limit (say 3 or 5)
- Expired OTP: rejected, with a "Resend" option
- Resend: the new OTP makes the old one invalid; the...
FresherMost askedScenarioFree with sign-inAnswerHideYou are given 30 minutes on a demo shop website. How do you test it and what do you deliver?
- Look around (3 minutes): browse the pages and find the main flows (browse, search, product, cart, checkout, account).
- Write scenarios first (5 minutes), by area: registration and login, product list and filters, product detail, cart, checkout, order history, responsive layout.
- Explore each flow...
FresherMost askedScenarioFree with sign-inAnswerHideYou have 20 minutes to find bugs in a demo to-do app. How do you approach it?
- First 2 minutes: use the happy path (add, complete, delete) to learn how the app works.
- Next, attack the input: empty, spaces, 1,000 characters, emoji,
<b>bold</b>,<script>alert(1)</script>, duplicates. - State and saved data: refresh, open a second tab, clear storage, go offline.
- Controls: filters...
FresherMost askedScenarioFree with sign-inAnswerHideHow do you write a good bug report from an exploratory testing session? Show an example.
Stop exploring, reproduce the issue, cut the steps to the fewest, then write one bug per report.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a fund transfer in a banking app.
Positive
- Valid receiver and an amount within the balance: debit and credit happen once, with a reference number and an SMS or email confirmation
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test a form with 20 fields without writing hundreds of test cases?
Use test design techniques to cut the number of tests:
- Equivalence partitioning and BVA (boundary value analysis) for each field: one valid group, invalid groups, and the boundaries.
- Group fields by type: use one reusable checklist for all text fields, all number fields, all date fields.
- **Decision...
FresherMost askedScenarioFree with sign-inAnswerHideHow do you test a form field that accepts an email address?
Valid: [email protected], [email protected], uppercase letters, numbers, subdomain.
Invalid: no @, two @, missing domain (a@), missing user (@x.com), spaces inside.
Also invalid: no dot in the domain if required, dot at the end, comma instead of dot, Unicode spaces.
Boundary: very short...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a pen.
Show that you can test an object with no spec by asking questions first (purpose, type: ball point, gel, fountain; users).
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for an elevator (lift).
Ask first: capacity, number of floors, single lift or a group of lifts.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a search filter and sort on a product listing page.
- Each filter alone (category, brand, price range, rating) shows only matching products and the right count
- Different filters combine with AND; values in the same group (two brands) combine with OR
- Price range: min greater than max, min equal to max, negative, empty, not a number
- Clear filters resets the list;...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a contact us form.
- A valid name, email, subject and message submit; a success message shows; the email reaches the support inbox
- Each required field empty on its own, and all empty together
- Wrong email; phone with letters; message at the minimum and maximum length (and over)
- HTML or script input is made safe; emoji and...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a coupon or promo code feature.
- A valid code lowers the total correctly (percentage and fixed amount), rounded to 2 decimals
- Wrong code, expired, not active yet, already used, wrong letter case, spaces around the code
- Minimum cart value, only some categories or products, sale items left out
- One use per user vs unlimited use; total usage...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a user profile update page.
- Update name, phone, address and profile photo: saved, and shown after a refresh and on other pages
- Required fields empty; wrong phone or email format; maximum length
- Photo: allowed types and size, very large dimensions, cropping
- An email change needs verification; the new email is already used
- A password...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a ticket booking system (movie or bus).
- Search by date or route, choose seats, pay, and get a ticket with a unique ID or QR code
- Seat map: booked seats cannot be chosen; a maximum number of seats per booking; select and unselect
- Two users choose the same seat at the same time: one succeeds and the other sees a clear message
- A seat hold timer (for...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a chat or messaging application.
- Send and receive text in real time; delivery ticks (sent, delivered, read)
- An empty message is blocked; a very long message; emoji, links, code, text in many languages
- Media: image, file, voice; size limits; preview and download
- Group chat: add or remove members, admin rights, messages seen only by members -...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a calculator application.
- Basic operations: 2+3, 9-12 (negative result), 6x7, 8/2
- Division by zero: show an error and do not crash; 0/0
- Decimals: 0.1+0.2 shows 0.3 (rounding is handled); long decimals; zeros at the start; more than one dot is rejected
- Very large numbers and overflow, scientific notation, negative numbers
- Chained...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a ride-booking app (like a taxi app).
- Set pickup and drop; fare estimate; choose a vehicle type; a driver is assigned with a live arrival time
- Invalid location, same pickup and drop, location not available, outside the service area
- GPS permission denied; poor accuracy; the map and driver position update
- Cancel before and after a driver is...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a REST login endpoint (POST /login).
- 200 and a token for valid credentials; the response has no password hash
- 400 for missing or bad JSON or empty fields; 401 for a wrong password or unknown user, with the same message
- 415 or 400 for the wrong content type; extra or unexpected fields are ignored
- Token expiry, format and claims are correct; the...
FresherMost askedScenarioFree with sign-inAnswerHideHow would you test a mobile number input field (10 digits)?
- A valid 10-digit number is accepted (for example 9812345678)
- 9 digits and 11 digits are rejected (boundary); exactly 10 digits is the boundary
- Letters, symbols, spaces,
+and country code, zero at the start: follow the spec - Paste with spaces or dashes: cleaned or rejected
- Empty field when it is required;...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a user role and permission system (admin, editor, viewer).
Build a table of roles and actions, and test each cell.
- Admin: create, edit and delete users, change settings. Editor: edit content but cannot manage users. Viewer: read only
- A direct URL or API call to a forbidden action returns 403, even if the button is hidden in the UI
- A role change works without a new login...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for pagination.
- The first page loads with the expected number of items; Previous is disabled on the first page, and Next is disabled on the last
- Next, Previous, a page number, and First/Last go to the right page
- Exactly one page of data, zero results, N+1 items (the last page has one item)
- Changing the page size (10, 25, 50)...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a date picker.
- Pick a date from the calendar and by typing; the format matches the locale (DD/MM/YYYY vs MM/DD/YYYY)
- Boundaries: minimum and maximum allowed date, today, tomorrow, yesterday
- Invalid dates: 31 Feb, 30 Feb, 00/00/0000, letters, empty
- Leap day (29 Feb 2024 is valid, 29 Feb 2023 is invalid)
- Month and year...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a logout feature.
- Logout goes to the login or home page and clears the session cookie or token
- The Back button does not show protected pages; pages ask for login again
- The token is not valid on the server after logout (call an API with the old token: 401)
- Logout in one tab logs out the other tabs; logout on one device vs on all...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a ratings and reviews feature.
- Star rating from 1 to 5, submit with and without text; the average rating and count update
- Rating 0, 6, or half-stars if not supported; empty review
- Only verified buyers can review; one review per user per product; edit and delete your own
- Review length limits, bad-word filter, HTML and links made safe -...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a download statement (PDF or CSV export) feature.
- Download for a chosen date range; the file opens correctly; the file name has the date range
- Contents match the screen and the database: totals, dates, currency format, order
- An empty range gives a file with only a header, or a message
- A very large range (100,000 rows): it finishes, or runs as a background job...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a dropdown (select) field.
- The default value or placeholder shows; the list opens and closes; choosing an option updates the field
- All options are there, in the right order, with no repeats and with the right labels
- Keyboard: arrow keys, Enter, type to jump, Escape
- Search inside long dropdowns; multi-select adds and removes chips -...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for an address form.
- All fields valid: the address is saved; choosing a saved address fills the form
- Required fields: name, street, city, postcode, country, phone
- Postcode formats for each country; the state list changes with the country
- Phone: country code, letters, spaces and dashes
- Maximum lengths; apostrophes and non-English...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWrite test cases for a notification feature (push, email, in-app).
- An event triggers the notification once, with the right content, link, time and user
- Channels: push, email, SMS, in-app badge; each follows user preferences and opt-out
- Read and unread state, mark all as read, the badge count is right
- An offline device gets it later; old notifications are dropped
- Repeated...
FresherMost askedScenarioFree with sign-inAnswerHideWrite test cases for a bank account balance check.
- The balance equals the ledger or database value after deposits, withdrawals and pending transactions
- The difference between available and current balance when money is on hold
- After a transaction, the refresh updates within the SLA (agreed time)
- Currency format and rounding; a negative balance shows for an...
ExperiencedScenarioFree with sign-inAnswerHideWrite test cases for a QR code scanner or QR-based payment.
- Scan a valid code: the right merchant and amount show, and payment is confirmed
- Invalid, damaged, blurred, expired, or non-payment QR: show a clear message
- Low light, angle, distance; flashlight button; scan from a gallery image
- Camera permission denied or blocked: guide the user to settings
- Static QR with...
API Testing
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhat negative tests would you write for a POST /users endpoint?
- Missing required fields, one at a time, and an empty body
- Wrong types (age as a string, email as a number) and nulls
- Invalid formats (bad email, bad date), very long strings, limit values
- Duplicate unique value (email already exists): 409
- Broken JSON, wrong Content-Type (415), unsupported method (405) -...
ExperiencedMost askedScenarioFree with sign-inAnswerHideAn API works in Postman but fails from the front end. How do you investigate?
- Open the browser dev tools and the Network tab. Compare the failing request with the Postman one (URL, method, headers, body, cookies).
- Check the Console for CORS errors. Look at the preflight
OPTIONSresponse. - Look for a missing or different
Authorization,Content-Type, or cookie setting (SameSite,...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you validate API data against the database?
Call the API, then query the database for the same record and compare field by field (grey box testing).
FresherMost askedScenarioFree with sign-inAnswerHideHow do you test a REST API's CRUD lifecycle end to end?
Run one chained scenario and check the state at each step:
- POST create: expect 201 and save the
id - GET by id: 200 and the same data
- PUT/PATCH update: 200/204, then GET shows the new values
- GET list: the resource appears (and filters work)
- DELETE: 204
- GET again: 404
- DELETE again: 404 or 204 (idempotent, no 500 error)
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test rate limiting in an API?
Find the documented limit (for example 100 requests per minute per key). Then:
- Send requests in a loop until you pass the limit. Confirm 429 Too Many Requests.
- Check the response headers:
Retry-After,X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset. - Wait for the time window to end and...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test an API when the backend is not ready?
Use the API contract (OpenAPI/Swagger) and a mock server. Postman mock servers, WireMock, Mockoon or json-server return example responses. Testers can then write requests, checks and schema tests. Frontend developers can also work at the same time. Design test cases from the contract, including error responses. When the real service is ready, point the same collection at it by changing the baseUrl environment variable. Then fix any differences between the mock and the real behavior.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test an API for security vulnerabilities?
Cover the themes of the OWASP API Security Top 10:
- Broken object-level authorization (IDOR): change IDs in the path or body to read another user's data
- Broken authentication: weak tokens, no lockout, token reuse after logout
- Too much data in responses: password hashes or internal fields appear in the...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you measure and test API performance?
Measure response time (average and percentiles p90/p95/p99), throughput, error rate and resource use. Tools: JMeter, k6, Gatling, and Postman monitors for simple checks.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you debug a failing API test in CI that passes locally?
First compare the environments: base URL, versions, config and secrets. Then check the test data. Was it already created? Do tests depend on each other or on order? Do parallel runs share data?
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you test a file upload API?
- Upload allowed types with
multipart/form-data: expect 201, and the stored file can be fetched - Wrong type, fake extension, empty file, file over the size limit (and exactly at the limit)
- Missing file part, wrong field name, many files
- Auth is required, and a user cannot read other users' files
- File name...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you test a webhook?
A webhook is an HTTP callback. The system sends it to your URL when an event happens.
- Set up a receiver (webhook.site, a local server with a tunnel, or a mock) and trigger the event.
- Check the payload fields, the headers, and the signature (HMAC). The receiver uses the signature to trust the sender.
- The receiver...
ExperiencedMost askedScenarioFree with sign-inAnswerHideExplain how you would test an API that depends on another service.
Use mocks to test your own logic in a fast and reliable way. Mock these cases: a normal response, a slow response, error codes (4xx/5xx), a broken body, a timeout, and a partial outage. Add a small set of integration tests against the real sandbox to confirm the contract.
Selenium
ExperiencedMost askedScenarioAnswerHideYour Selenium tests are unstable (they pass sometimes and fail other times). How do you investigate and fix them?
I would treat unstable tests as a defect, not as noise. First I find the category.
- Collect evidence: rerun the failing test 20 times. Capture screenshots, page source, browser console and network logs. Note the pass rate for each environment.
- Find the cause:
- Timing: missing waits, animations, async rendering. Fix with explicit conditions, not sleeps.
- Test data: shared accounts, order dependence, leftover state. Create data for each test and clean it up.
- Locators: unstable ids, stale elements.
- Environment: slow CI, shared test server, third-party calls. Mock external services.
- A real race condition in the product. Report it as a bug.
- Fix the root cause. Then put any still-unstable test in quarantine with a tag so it stops blocking the pipeline. Keep a list of quarantined tests.
- Prevent it: run new tests many times before merging. Track the failure rate on a dashboard.
Automatic retries only hide the problem. I allow one retry at most while the root cause is being fixed.
What they are checking: Whether you have a clear method and do not hide unstable tests with retries
ExperiencedMost askedScenarioFree with sign-inAnswerHideTests pass on your machine but fail in CI. How do you find the cause?
I compare the two environments and make the CI failure easy to see.
ExperiencedMost askedScenarioFree with sign-inAnswerHideA click fails with ElementClickInterceptedException. What do you do?
It means another element covers the target at the click point. Examples are a cookie banner, spinner, sticky header or modal.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhat causes ElementNotInteractableException and how do you resolve it?
The element is in the DOM but cannot take the action. It may be hidden, zero size, disabled, off-screen, or not yet drawn.
ExperiencedMost askedScenarioFree with sign-inAnswerHideYour Selenium regression suite takes three hours. How would you cut the time?
I would measure first. Then I would fix the biggest costs.
ExperiencedMost askedScenarioFree with sign-inAnswerHideAfter clicking Save, your assertion on the success message fails intermittently. How do you fix it?
The assertion runs before the page finishes updating. So the test races the application.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you handle CAPTCHA, OTP and two-factor authentication in automated tests?
You do not automate the CAPTCHA itself. You remove it from the test path.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhen would you recommend moving from Selenium to Playwright, and how would you migrate?
I would recommend it when the team has unstable tests (tests that pass sometimes and fail other times) and slow suites on modern JavaScript apps. It also fits when the team needs built-in tracing, network mocking, and fast parallel runs, and is happy with Chromium, Firefox and WebKit only.
Playwright
ExperiencedMost askedScenarioAnswerHideHow do you reuse login state across tests with storageState?
Log in once, save the cookies and storage to a file, and load that file in every test context. This removes the login screen from most tests and saves minutes.
// auth.setup.ts
import { test as setup, expect } from '@playwright/test';
setup('authenticate', async ({ page }) => {
await page.goto('/login');
await page.getByLabel('Email').fill(process.env.USER_EMAIL!);
await page.getByLabel('Password').fill(process.env.USER_PASSWORD!);
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page).toHaveURL(/dashboard/);
await page.context().storageState({ path: 'playwright/.auth/user.json' });
});
In playwright.config.ts, define a setup project. Make the browser projects depend on it with use: { storageState: 'playwright/.auth/user.json' }. Add the .auth folder to .gitignore. For different roles, save one file per role. Keep one separate test that uses the real login form.
What they are checking: Whether you can speed up a suite by reusing login
ExperiencedMost askedScenarioFree with sign-inAnswerHideYour Playwright tests are unstable on CI (they pass sometimes and fail other times). How do you handle it?
Find the cause before you add retries.
ExperiencedMost askedScenarioFree with sign-inAnswerHideA Playwright test fails locally and you do not know why. How do you debug it?
Start with simple tools and move to detailed ones.
ExperiencedMost askedScenarioFree with sign-inAnswerHideYou get a strict mode violation error. What does it mean and how do you fix it?
The locator matched more than one element. For actions like click or fill, Playwright will not guess which one you mean.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you combine API calls and UI actions in one test?
Use the API for setup and checking. Use the UI only for what you are testing. This makes tests faster and less fragile.
ExperiencedMost askedScenarioFree with sign-inAnswerHideA third-party service (payment or maps) is slow and breaks your tests. How do you handle it?
Keep the test apart from that dependency.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhen would you use getByTestId instead of getByRole?
Use getByRole and getByLabel first. They test what users and assistive tools (like screen readers) see, and they also catch accessibility problems. Use getByTestId when:
- The element has no accessible role or name (a canvas, a chart, an icon button that cannot be named).
- The text changes with language or A/B experiments.
- Many identical elements need a stable handle.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you migrate a Cypress or Selenium suite to Playwright?
Move step by step. Do not rewrite everything at once.
Automation Framework
ExperiencedMost askedScenarioAnswerHideHow would you design a test automation framework from scratch?
I would start from goals, not tools.
- Clarify scope: app type (web, API, mobile), team skills, release speed, environments, and what must run on each pull request.
- Choose a stack that fits the team. For example, Playwright with TypeScript, or Selenium with Java and TestNG. Add a runner and an assertion library.
- Define layers: tests, page objects or API clients, shared helpers, config, and test data factories.
- Build in common needs from day one. These are environment config, secrets handling, logging and a retry policy. Add reporting (Allure or HTML), screenshots and traces on failure, and tags for smoke and regression.
- Set up CI with a fast smoke suite on each PR and a nightly regression. Run them in parallel in containers.
- Write coding rules. Review tests like production code. Document how to add a test.
- Start with a small suite of high-value tests. Prove it is stable, then grow it.
Success means people trust the results: few unstable tests (tests that pass sometimes and fail other times), quick feedback and low maintenance cost.
What they are checking: Whether you design for easy maintenance and team use
ExperiencedMost askedScenarioAnswerHideHow do you deal with unstable tests (tests that pass sometimes and fail other times) in an automation suite?
I measure, find the cause, fix and prevent.
- Measure: track how often each test fails and passes from CI history. Mark the unstable tests. Do not guess.
- Find the root cause. It may be timing and waiting problems, shared or old data, or tests that depend on order. It may be an unstable environment or third-party services. It may also be a real product bug that appears only sometimes.
- Fix the cause: waits based on conditions, unique data per test, mocks for unstable services, stable locators, and isolation.
- Quarantine (set aside) tests that cannot be fixed quickly, so the pipeline stays trusted. Give each one an owner and a deadline.
- Prevent: review new tests. Run them many times (for example 20) before merging. Allow at most one retry.
If the team ignores unstable tests, people learn to ignore red builds.
What they are checking: Whether you treat unstable tests as an engineering problem
ExperiencedMost askedScenarioFree with sign-inAnswerHideTell me about a project you led and your responsibilities.
Use a clear structure: context, your role, actions, result.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you plan testing for a large e-commerce website?
I would use a risk-based plan, ordered by business impact.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you use AI to triage bugs and draft bug reports?
I would use AI to reduce routine work. A person confirms the decisions.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you mentor and onboard junior testers?
I give structure, early wins and feedback.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you decide on release sign-off?
Sign-off is a risk decision based on evidence. The team agrees the exit criteria (the conditions to release) in advance.
FresherMost askedScenarioFree with sign-inAnswerHideYou are asked to find bugs in a simple todo list app in 15 minutes. How do you approach it?
Explore in an organised way and report clearly.
ExperiencedMost askedScenarioFree with sign-inAnswerHideThe UI changes often and your automation keeps breaking. What do you do?
Reduce how much the tests depend on UI details.
ExperiencedMost askedScenarioFree with sign-inAnswerHideYour regression suite fails on every build and the team stops trusting it. What do you do?
Win back trust first, then improve.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you decide what to test when time before release is short?
Use risk-based priorities.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you test a third-party integration end to end?
I would test at several levels, because I do not control the other system.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you choose between tools, for example Selenium, Playwright or Cypress, for a new project?
I decide using criteria, then I run a short proof of concept.
Criteria: app type and browser needs, team language skills, stability and speed, parallel runs and CI fit, and debugging tools. Also community and long-term support, cost, and fit with existing reporting.
Cypress
ExperiencedMost askedScenarioAnswerHideCompare Cypress, Selenium and Playwright. Which would you pick for a new web project and why?
There is no single best tool. Pick by your constraints.
- Selenium: the widest language and browser support (including real Safari and old browsers). It has a huge ecosystem. But you build the waits, runner, reporting and parallel runs yourself.
- Cypress: the best developer experience for front-end teams. It has time-travel debugging, automatic retries and built-in network stubbing. Limits: JavaScript/TypeScript only, one tab per test, cross-origin needs
cy.origin, and parallel runs are easiest with Cypress Cloud. - Playwright: many languages (JS/TS, Python, Java, .NET). It supports Chromium, Firefox and WebKit, multiple tabs and contexts, built-in parallel runs and tracing, and free sharding (splitting tests across machines).
For a new JS/TS web project I would pick Playwright and Cypress as the two finalists. Then I would run a one-week trial on the three hardest flows (login with SSO, file upload, multi-tab). If the app needs multi-tab or multi-user flows, or testers who do not write JS, Playwright wins. If the team is front-end heavy and likes component testing and the interactive runner, Cypress is a good fit.
What they are checking: Decisions based on trade-offs and a test plan, not loyalty to one tool
ExperiencedMost askedScenarioAnswerHideWhy is `cy.wait('@alias')` better than `cy.wait(5000)`? A test fails at random on a slow data table. How do you fix it?
A fixed cy.wait(5000) is a guess. It is too short on a slow day and wastes time on a fast day. cy.wait('@alias') waits exactly until one request finishes, then goes on at once.
Fix for the unstable table test (it passes sometimes and fails other times):
cy.intercept('GET', '/api/customers?*').as('getCustomers');
cy.visit('/customers');
cy.wait('@getCustomers');
cy.get('[data-cy="row"]').should('have.length.greaterThan', 0);
Steps I would take:
- Find the request that fills the table. Give it an alias before you open the page.
- Wait for the alias. Then assert on the DOM, so Cypress retries until the page has finished drawing.
- If the page shows a spinner, assert
cy.get('[data-cy=spinner]').should('not.exist'). - Remove all fixed waits. Keep one only when there is no signal to watch, and add a comment to say why.
What they are checking: Replacing sleeps with waits that give the same result every time
ExperiencedMost askedScenarioAnswerHideYour suite takes too long because every test logs in through the UI. How do you speed it up?
Treat login as setup, not as the thing you test. Test the login form in one or two special specs. Skip it everywhere else.
- Log in with
cy.requestto the auth endpoint, which sets the cookie. Or put the token in localStorage. - Wrap it in
cy.session, so it is saved across tests and specs. - Add a
validatestep, so an expired session logs in again by itself. - Use one test user per role, with known data. Create them with a seed script or an API.
cy.session('admin', () => {
cy.request('POST', '/api/auth', { user: 'admin', pass: Cypress.env('ADMIN_PASS') })
.then(({ body }) => window.localStorage.setItem('token', body.token));
});
cy.visit('/dashboard');
This usually saves several seconds per test. It also removes a common cause of unstable tests. Keep passwords in environment variables or CI secrets, never in the repo.
What they are checking: Practical ways to make a test suite faster
ExperiencedMost askedScenarioAnswerHideA Cypress test passes on your machine but fails, or passes sometimes and fails other times, in CI. How do you debug it?
Work from evidence, not guesses.
- Reproduce: run without a visible browser, in the same browser and screen size as CI. Run the single test in a loop (
--specand a repeat loop) to measure how often it fails. - Read the artifacts: failure screenshot, video, Cypress Cloud or console logs, and the network log. Use the time-travel snapshots in
cypress open. - Find the type of cause:
- Timing: asserting before data loads, fixed waits, animations. Fix with
cy.interceptaliases and a retrying.should. - Shared state: tests depend on order or leftover data. Make each test add and clean its own data.
- Selectors: changing classes, duplicate elements, detached DOM.
- Environment: slower CI, different data, third-party scripts.
- Timing: asserting before data loads, fixed waits, animations. Fix with
- Fix the root cause. Do not just add retries. Use
retries: { runMode: 2 }only as a safety net, and track retried tests as unstable. - If a test cannot be fixed quickly, quarantine it (tag it, or skip it with a ticket). Then it does not block the pipeline.
What they are checking: A clear method for unstable tests, the most common QA automation question
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you run Cypress in CI and parallelise it?
Run without a visible browser, with a fixed Node and Cypress version and a built app.
ExperiencedMost askedScenarioFree with sign-inAnswerHideYour Cypress suite passes on your machine but fails only in CI. What do you check?
I compare environment, timing and data, in that order.
ExperiencedMost askedScenarioFree with sign-inAnswerHideThe Cypress suite now takes 40 minutes and blocks releases. How would you cut it down?
Measure first, then remove waste.
ExperiencedMost askedScenarioFree with sign-inAnswerHideCan Cypress handle multiple browser tabs or windows? What are the workarounds?
No. Cypress controls a single tab and cannot switch to a new one. Common workarounds:
- Remove the
targetattribute so the link opens in the same tab:
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhat is conditional testing and why is it discouraged in Cypress?
Conditional testing means choosing a path based on the current DOM (if element exists, click it). It is discouraged because the DOM changes over time. Checking at one moment creates a race condition. The test then gives different results on different runs.
ETL Testing and Data QA
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test incremental loads?
An incremental load processes only the records that are new or changed since the last run. It usually uses a watermark (a timestamp or id) or change data capture.
ExperiencedMost askedScenarioFree with sign-inAnswerHideA dashboard shows a different number than the source system. How do you find the cause?
Trace the number backwards, layer by layer. Split the problem in half each time.
ExperiencedMost askedScenarioFree with sign-inAnswerHideThe row counts match between source and target, but the business says some values are wrong. What do you do?
Matching counts only prove the number of rows. Move to row-level and column-level comparison.
ExperiencedMost askedScenarioFree with sign-inAnswerHideAfter the daily load, duplicates appear in the fact table. How do you investigate?
Find what is duplicated, then find out why.
- Define the duplicate. Is it the same business key, or a whole-row copy?
ExperiencedMost askedScenarioFree with sign-inAnswerHideThe ETL job shows 'success' but yesterday's data is missing in the report. What do you check?
A green job does not prove the data is correct. Work outward from the symptom.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhat is data migration testing and what do you validate?
Migration testing checks that data moved from an old system to a new one is complete, correct and usable.
ExperiencedMost askedScenarioFree with sign-inAnswerHideA source system adds a column and changes a data type without notice, and the pipeline breaks or silently loads wrong data. How do you test for and prevent this?
This is schema drift. Approach:
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you compare two large tables in different databases efficiently?
Do not pull everything into one place. Compare summaries first. Look closely only where they differ.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test timeliness and late-arriving data?
Timeliness: data must be available by the SLA time.
- Check the latest load time and compare it with now. Alert if the lag is above the limit.
- Test the job's start and end time against the time window with realistic volume.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you handle testing when the source data keeps changing during your test run?
You need a stable snapshot that you can compare against.
Performance Testing
ExperiencedMost askedScenarioAnswerHideHow do you design and run a performance test with JMeter, and what metrics do you report?
I follow a repeatable process:
- Define goals: critical transactions, user counts and targets (for example p95 under 500 ms, error rate under 1 percent, 300 requests per second).
- Build a workload model from production analytics: transaction mix, peak users and think times.
- Prepare a production-like environment and test data. Make sure the load generator is not the bottleneck.
- Script in JMeter: samplers, correlation, parameterisation, assertions and timers.
- Run a smoke test, then baseline, load, stress and soak runs in non-GUI mode.
- Monitor servers, application and database (CPU, memory, GC, connection pools, slow queries).
- Analyse and report.
Metrics to report: throughput, average and p90/p95/p99 response times per transaction, error rate and error types, active users over time, and server resource use. Also add what you saw, the bottlenecks found, risks and advice.
What they are checking: Can you plan and report a complete test?
ExperiencedMost askedScenarioFree with sign-inAnswerHideResponse time increases sharply as load grows. How do you find the bottleneck?
I work from the symptom down to the layer.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you prepare an e-commerce site for a big sale event?
Plan capacity from the expected peak and test beyond it.
ExperiencedMost askedScenarioFree with sign-inAnswerHideCPU is low but throughput stops increasing under load. What could be happening?
Low CPU with a throughput ceiling means the system is waiting, not computing. Likely causes:
- Connection pool exhausted (database or HTTP client), so threads queue.
- Thread pool or worker count too small, with requests waiting in the server.
- Lock contention, synchronised sections, or a single-threaded component. -...
ExperiencedMost askedScenarioFree with sign-inAnswerHideDuring a soak test memory keeps growing over hours. What do you do?
That pattern suggests a memory leak or a cache with no size limit.
ExperiencedMost askedScenarioFree with sign-inAnswerHideError rate rises above the threshold during a load test. How do you analyse it?
First, sort the errors into types.
ExperiencedMost askedScenarioFree with sign-inAnswerHideThe business expects 500 requests per second at peak. How many virtual users do you need?
Use Little's Law with the full user cycle.
- Requests per second per user = 1 / (response time + think time).
- Say the average response time is 0.4 s and think time is 3.6 s. A cycle is 4 s, so one user makes 0.25 requests per second.
- Users needed = 500 / 0.25 = 2000 virtual users.
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhy does the test environment matter, and what if it is smaller than production?
Performance results are valid only if the environment is like production. This covers hardware, configuration, database size, network and third-party setup.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you performance-test a microservices application?
Test at several levels. The slowest service or dependency often limits the whole chain.
ExperiencedMost askedScenarioFree with sign-inAnswerHideA release fails its performance SLA a day before go-live. What do you do?
Stay calm, put numbers on the problem and give options.
SQL for Testers
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test a database? What is database testing?
Database testing checks that the data layer is correct and reliable:
- Data integrity: values are stored correctly, there are no orphan rows, and the FK, PK, unique, check and NOT NULL rules work
- Data mapping: actions in the UI or API change the right tables and columns. Check insert, update and delete with...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you validate that data shown on the UI matches the database?
- Do the action or open the page. Note the values you see and the record ID.
- Query the database for the same record. Join the tables the page reads from.
- Compare field by field. Allow for formatting: dates, currency, rounding, trimmed spaces, and status codes like
1= Active. - Check counts and totals....
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you find rows in one table that do not exist in another (for example a data migration check)?
Compare the source and the target by key.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you test a data migration?
- Before: study the source data (row counts, nulls, duplicates, min and max, different values). Read the mapping document. Take a backup. Test on a copy.
- After: row counts match. Checksums or sums of number columns match. Sample records match field by field. Keys and relationships (FK) are intact, with no...
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow would you find and fix a slow SQL query?
- Reproduce the problem and measure it. Then run
EXPLAIN(orEXPLAIN ANALYZE). It shows full table scans, row estimates and join order. - Add or fix indexes on columns used in WHERE, JOIN and ORDER BY. Put the columns of a composite index in the right order.
- Avoid
SELECT *, functions on indexed columns,...
ExperiencedMost askedScenarioFree with sign-inAnswerHideWhat is SQL injection and how do you test for it?
SQL injection happens when user input is joined into a query as plain text. An attacker can then change what the query means. An example is ' OR '1'='1 in a login field.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you check data consistency between two systems (for example the API and the database) using SQL?
Export or fetch the API data. Load it into a staging table, or compare IDs and key fields with a query on the database side. Check counts first. Then check totals (SUM(amount)). Then find row differences with LEFT JOIN ... IS NULL in both directions. Group the differences by type: missing, extra, or changed values. Put the checks in a script that runs after each deployment and reports mismatches. Look for timing causes (replication lag, caching) before you log a bug.
ExperiencedMost askedScenarioFree with sign-inAnswerHideHow do you verify that a bug fix did not corrupt data? Which checks do you run in the database?
Take a snapshot before the fix. Save row counts, checksums or sums of key columns, and a copy of some rows. Apply the fix, run the scenario, then compare. Check these points:
- Only the rows you meant to change were changed. Compare by primary key and by timestamp columns like
updated_at. - Related tables and FK relations are still correct.
- Totals still add up.
- No new NULLs or duplicates appeared.
- Audit or history tables recorded the change.