20 Test Case Examples for Web, Mobile & API Testing | QA Sphere
Writing test cases from scratch is hard when you are staring at a blank page. Most QA teams do not struggle with the idea of testing; they struggle with turning that idea into clear, reusable, executable test cases that another tester can pick up and run without confusion.
That is why concrete test case examples are so useful. They show what "good" looks like: a clear title, realistic preconditions, actionable steps, and an expected result that leaves no room for interpretation.
In this guide, we will walk through 20 practical test case examples across web, mobile, and API testing. Use them as inspiration, adapt them to your product, and add them to your test case management process.
What a Good Test Case Looks Like
Before we jump into examples, it helps to align on structure. A useful test case is specific enough to be repeatable, but short enough to stay maintainable when the product changes.
| Field | What to Include | Example |
|---|---|---|
| Title | What scenario is being tested | Verify user can log in with valid credentials |
| Preconditions | Required setup before execution | Registered active user account exists |
| Steps | Clear sequence of user or system actions | Open login page, enter email, enter password, click Sign In |
| Expected Result | Observable outcome | User lands on dashboard |
| Priority | How critical the scenario is | Critical |
| Tags | Useful labels for filtering | smoke, auth, regression |
Rule of thumb: If the expected result could be interpreted in two different ways, rewrite it. Ambiguous expected results create flaky manual testing just as surely as brittle selectors create flaky automation.
5 Quick Rules Before You Copy These Examples
- Write for your product, not a textbook. Replace generic names with real screens, endpoints, fields, and business rules.
- Separate one assertion from another. A single test case should validate one main behavior, not an entire workflow universe.
- Always include negative scenarios. Happy paths are not enough.
- Keep test data explicit. If the scenario depends on a specific user role, locale, plan, or payload, say so.
- Store examples in a real tool. Spreadsheets are fine at the beginning, but structured platforms like QA Sphere make reuse, execution, and reporting much easier as the library grows.
8 Web Application Test Case Examples
Web applications combine UI flows, business logic, browser behavior, and session state. These are the kinds of examples most teams need first.
1. Login with Valid Credentials
Preconditions: Active user account exists.
Steps:
- Open the login page.
- Enter a valid email address.
- Enter the correct password.
- Click Sign In.
Expected Result: User is authenticated and redirected to the dashboard.
2. Login with Invalid Password
Preconditions: Active user account exists.
Steps:
- Open the login page.
- Enter a valid email address.
- Enter an incorrect password.
- Click Sign In.
Expected Result: Login is blocked and a clear error message is displayed without revealing whether the email exists.
3. Required Field Validation on Sign-Up Form
Preconditions: User is on the sign-up page.
Steps:
- Leave all required fields empty.
- Click Create Account.
Expected Result: Required field validation messages appear for each mandatory field, and the form is not submitted.
4. Password Reset Flow
Preconditions: User account exists and mailbox is accessible.
Steps:
- Open the login page.
- Click Forgot Password.
- Enter the registered email address.
- Submit the request.
- Open the reset email and follow the link.
- Set a new valid password.
Expected Result: Password reset completes successfully and the user can sign in with the new password.
5. Add Product to Cart
Preconditions: User is on an in-stock product page.
Steps:
- Select a product variant if applicable.
- Click Add to Cart.
- Open the cart page or mini-cart.
Expected Result: Selected product appears in the cart with the correct quantity, variant, and price.
6. Checkout with Promo Code
Preconditions: Cart contains eligible item and valid promo code exists.
Steps:
- Open the checkout page.
- Enter the valid promo code.
- Apply the code.
Expected Result: Discount is applied correctly and the order total is recalculated in real time.
7. Session Timeout After Inactivity
Preconditions: User is logged in.
Steps:
- Stop interacting with the application for the configured inactivity window.
- Attempt to navigate or refresh the page.
Expected Result: Session expires securely and the user is redirected to login with an informative timeout message.
8. File Upload with Unsupported Format
Preconditions: User is on a screen that allows file upload.
Steps:
- Choose a file with an unsupported extension.
- Submit the upload.
Expected Result: Upload is rejected and the UI explains which formats are allowed.
Written by
QA Sphere TeamThe QA Sphere team shares insights on software testing, quality assurance best practices, and test management strategies drawn from years of industry experience.



