Test case writing interview questions check whether you can turn a requirement into checks someone else can run. Expect to explain the fields of a test case, the difference between a scenario and a case, and then write test cases live, usually for a login page or a shopping cart. This page has 25 questions with short answers and complete sample test cases for both.
How to answer test case writing questions
Answer with requirement, then technique, then cases. "The password must be 8 to 16 characters, so I use boundary values: 7, 8, 16 and 17 characters. 8 and 16 should pass, 7 and 17 should show an error."
Pro tip: When asked to "write test cases for X", first ask one or two questions about the rules, such as the password length or what happens after three wrong tries. Interviewers like testers who clarify before writing.
Test case basics questions
Q1. What is a test case?
30-second answer: A test case is a set of preconditions, steps, test data and an expected result used to check one specific behaviour of the software. Anyone following it should get the same result, which makes the test repeatable.
Q2. What are the standard fields of a test case?
| Field | What to write |
|---|---|
| Test case ID | Unique ID, such as TC_LOGIN_001 |
| Title | Short summary of what is checked |
| Requirement or story ID | Link to the requirement it covers |
| Preconditions | What must be true before starting |
| Test data | Exact values to use |
| Steps | Numbered actions, one per line |
| Expected result | What should happen |
| Actual result | What did happen (filled during execution) |
| Status | Pass, Fail, Blocked or Not Run |
| Priority | How important the case is to run |
30-second answer: ID, title, preconditions, data, steps and expected result are the core. Actual result and status are filled in when you run the test.
Q3. What is the difference between a test scenario and a test case?
| Point | Test scenario | Test case |
|---|---|---|
| Level | High-level: what to test | Detailed: how to test it |
| Example | "Check login with valid and invalid credentials" | "Enter a registered email and wrong password, click Login, see 'Invalid email or password'" |
| Contains | One line | Steps, data, expected result |
| Count | Few | Many per scenario |
30-second answer: A scenario is a one-line idea of what to test. Each scenario breaks into several test cases with exact steps and data. The manual testing interview questions page has more on this.
Q4. What is the difference between a test case and a test plan?
30-second answer: A test plan is a document for the whole project or release. It covers scope, approach, schedule, people, environments, risks and entry and exit criteria. A test case checks one behaviour. The plan says what will be tested and how; test cases are the detailed checks.
Q5. What makes a good test case?
30-second answer: It checks one thing, has a clear title, exact test data, simple numbered steps and an expected result that leaves no doubt. It is independent of other cases where possible, linked to a requirement and easy for another tester to run.
A bad expected result says "should work properly". A good one says "Dashboard opens and shows 'Welcome, Asha'".
Q6. What are positive and negative test cases?
30-second answer: Positive cases use valid input and check that the feature works, such as logging in with a correct email and password. Negative cases use invalid input or actions and check that the system handles them safely, such as a wrong password or an empty field. A good set has both, and usually more negative cases than positive ones.
Test design technique questions
Q7. What is boundary value analysis?
30-second answer: Bugs often hide at the edges of a range, so you test the values at and just beyond each limit. If age must be 18 to 60, test 17, 18, 60 and 61. Some testers also add 19 and 59.
Q8. What is equivalence partitioning?
30-second answer: You split inputs into groups that the system should treat the same way and test one value from each group. For age 18 to 60, the groups are below 18 (invalid), 18 to 60 (valid) and above 60 (invalid), so three values such as 10, 35 and 70 cover them.
Boundary value analysis and equivalence partitioning are used together.
Q9. What is a decision table?
30-second answer: A decision table lists combinations of conditions and the expected action for each. It suits rules with several inputs.
| Condition | Rule 1 | Rule 2 | Rule 3 | Rule 4 |
|---|---|---|---|---|
| Valid email | Yes | Yes | No | No |
| Valid password | Yes | No | Yes | No |
| Result | Login | Error | Error | Error |
Each column becomes a test case.
Q10. What is state transition testing?
30-second answer: It tests how a system moves between states after events. For a login with a three-try limit: Active, then one wrong try, two wrong tries, then Locked after the third. You test each move, including that a correct password after the lock still does not log the user in.
Q11. What is error guessing?
30-second answer: Using experience to guess where bugs are likely, such as spaces before an email, pasting a very long text, double-clicking Submit, using the browser back button after logout, or entering a script tag in a name field. It adds to formal techniques; it does not replace them.
Login page test case questions
Q12. Write test scenarios for a login page.
30-second answer: I would list these scenarios first, then write cases for each:
- Login with valid credentials
- Login with invalid credentials
- Empty and invalid field input
- Password field behaviour
- Account lock after failed attempts
- Forgot password link
- Session and logout
- Security checks
Q13. Write detailed test cases for a login page.
Requirement assumed: users log in with email and password; the password is 8 to 16 characters; the account locks after 3 wrong attempts.
| ID | Title | Steps | Test data | Expected result |
|---|---|---|---|---|
| TC_LOGIN_001 | Valid login | Enter email and password, click Login | asha@example.com / Valid@123 | Dashboard opens with the user's name |
| TC_LOGIN_002 | Wrong password | Enter registered email and wrong password, click Login | asha@example.com / Wrong@123 | Error "Invalid email or password", stays on login page |
| TC_LOGIN_003 | Unregistered email | Enter unknown email and any password, click Login | nobody@example.com / Valid@123 | Same generic error as TC_LOGIN_002 |
| TC_LOGIN_004 | Both fields empty | Click Login without entering anything | (blank) | Required-field messages for email and password |
| TC_LOGIN_005 | Invalid email format | Enter email without @, click Login | asha.example.com | "Enter a valid email" message |
| TC_LOGIN_006 | Password masked | Type a password | Valid@123 | Characters shown as dots |
| TC_LOGIN_007 | Password below minimum | Enter 7-character password | Abc@123 | Length validation message |
| TC_LOGIN_008 | Password at maximum | Enter 16-character password for a matching account | Abcdefgh@1234567 | Login succeeds |
| TC_LOGIN_009 | Lock after 3 failures | Enter wrong password 3 times | asha@example.com / Wrong@123 | Account locked message; correct password also refused until unlocked |
| TC_LOGIN_010 | Logout and back button | Log in, log out, press browser Back | Valid user | Login page shown; dashboard not accessible |
30-second answer: Cover valid login, wrong and unknown credentials, empty and badly formatted fields, password limits and masking, lockout, and logout. TC_LOGIN_003 expects the same message as TC_LOGIN_002 so attackers cannot tell which emails are registered.
Q14. Which security checks would you add for login?
30-second answer: The page uses HTTPS; the password is never shown in the URL or logs; SQL injection text such as ' OR '1'='1 in the email field is rejected safely; errors do not reveal whether the email exists; the session ends after logout and after the set idle time; and the lockout cannot be bypassed by refreshing.
Q15. Which login cases would you run first if you had 10 minutes?
30-second answer: Valid login, wrong password, empty fields, logout, and the lockout rule. These cover the main flow and the highest risks. I would note the cases I skipped so the team knows the gap.
Shopping cart test case questions
Q16. Write test scenarios for a shopping cart.
30-second answer:
- Add a product to the cart
- Change quantity
- Remove a product
- Price, discount and total calculation
- Stock limits
- Cart for guest and logged-in users
- Cart persistence after logout or closing the browser
- Proceed to checkout
Q17. Write detailed test cases for a shopping cart.
Requirement assumed: maximum 5 units per product; a coupon SAVE10 gives 10% off; delivery is free above ₹499.
| ID | Title | Steps | Test data | Expected result |
|---|---|---|---|---|
| TC_CART_001 | Add one product | Open product page, click Add to Cart | T-shirt, ₹399 | Cart count shows 1; product listed with ₹399 |
| TC_CART_002 | Increase quantity | In cart, change quantity from 1 to 3 | T-shirt | Line total ₹1,197; cart total updates |
| TC_CART_003 | Quantity above limit | Set quantity to 6 | T-shirt | Message "Maximum 5 units"; quantity stays at 5 or less |
| TC_CART_004 | Quantity zero | Set quantity to 0 | T-shirt | Item removed or quantity not accepted, as per requirement |
| TC_CART_005 | Remove product | Click Remove on an item | T-shirt | Item gone; totals recalculated; count updated |
| TC_CART_006 | Valid coupon | Apply SAVE10 to a ₹1,000 cart | SAVE10 | Discount ₹100; total ₹900 |
| TC_CART_007 | Invalid coupon | Apply a code that does not exist | SAVE99 | "Invalid coupon" message; total unchanged |
| TC_CART_008 | Free delivery boundary | Cart totals ₹499, then ₹500 | Products adding to these values | Delivery charged at ₹499, free at ₹500 |
| TC_CART_009 | Out-of-stock product | Try to add a product with 0 stock | Sold-out item | Add button disabled or clear message |
| TC_CART_010 | Cart kept after login | Add item as guest, then log in | Valid user | Item still in cart after login |
30-second answer: Cover add, update, remove, limits, totals, coupons, stock and persistence. TC_CART_008 is a boundary test on the free-delivery rule. The exact expected messages should come from the requirement.
Q18. How would you test the cart total calculation?
30-second answer: Add items with different prices and quantities and check each line total, the subtotal, discounts, taxes if shown, delivery charge and the final total. Include rounding with prices such as ₹99.99, a coupon with a minimum order value, and removing an item after applying a coupon to see whether the discount is recalculated.
Q19. What negative cases would you add for a cart?
30-second answer: Quantity as a negative number, a decimal or text; adding the same item twice quickly; applying an expired coupon; applying two coupons if only one is allowed; changing the price in the browser's developer tools before checkout; and a product going out of stock after it was added.
Review and maintenance questions
Q20. What is test coverage, and how do you show it?
30-second answer: Coverage shows how much of the requirements your tests check. A requirement traceability matrix (RTM) maps each requirement ID to its test case IDs, so you can see any requirement with no tests. The SDLC and STLC interview questions page explains the RTM.
Q21. How do you prioritise test cases?
30-second answer: By business importance and risk. P1 cases cover the main flows that must work, such as login and payment. P2 covers important but less used features. P3 covers rare cases and cosmetic checks. When time is short, run P1 first.
Q22. What do you do when a test case fails?
30-second answer: Repeat it to confirm, check the test data and environment, and make sure the expected result matches the current requirement. If it is a real defect, log a bug with steps, data, expected and actual results, and a screenshot, then link it to the test case. The bug life cycle and Jira interview questions page covers what happens next.
Q23. How do you keep test cases up to date?
30-second answer: Update them whenever a requirement changes, review them with the team each sprint, remove duplicates and cases for removed features, and keep IDs stable so links to bugs and stories still work.
Q24. Can you write test cases without requirements?
30-second answer: Yes, but carefully. I would use the app itself, similar products, user stories, emails and conversations with the developer or product owner. I would write down my assumptions, get them confirmed and mark those cases as based on assumptions.
Q25. What is the difference between a test case and a use case?
30-second answer: A use case describes how a user interacts with the system to reach a goal, written by business analysts during requirements. A test case checks that one part of that interaction works. One use case usually gives several test cases, both positive and negative.
Quick revision table
| Term | One line to remember |
|---|---|
| Test case | Steps, data and expected result for one check |
| Test scenario | One-line idea of what to test |
| Positive case | Valid input, feature works |
| Negative case | Invalid input, handled safely |
| BVA | Test at and just past each limit |
| Equivalence partitioning | One value per group |
| RTM | Requirements mapped to test cases |
How to practise
Write ten test cases each for an OTP login, a bus ticket booking form and an ATM withdrawal. Use the table format above, include boundary values for every limit, and add at least four negative cases each. Then ask a friend to run your cases without your help; anything they ask about needs a clearer step.
If you are moving into testing as a career, the guide on how to become a software tester explains the skills and steps.

