How to Write Test Cases for a Login Page (with Examples)
Step-by-step guide to writing test cases for a login page with 30+ real examples. Covers UI, functional, validation, security, and accessibility test cases for QA engineers.

Last updated: June 27, 2026 · 7 min read
A login page is the #1 test case exercise in QA interviews. This guide gives you 30+ production-grade test cases covering UI, functional, validation, security, and accessibility. Pair it with our Manual Testing Complete Guide and the Software Testing Interview Questions master list.
Login Page Anatomy
Before writing test cases, identify the components:
- Email / Username field
- Password field
- "Show password" toggle
- "Remember me" checkbox
- "Forgot password?" link
- "Sign in" button
- "Sign up" link
- Error message area
- Social login buttons (Google, Apple, etc.)
- CAPTCHA (when applicable)
UI Test Cases
TC_UI_001 — Email field is visible and editable
- Navigate to /login
- Verify email field is visible
- Verify field accepts text input
TC_UI_002 — Password field masks input
- Navigate to /login
- Click password field
- Type
TestPass123! - Verify input is shown as bullets/asterisks, not plain text
TC_UI_003 — Sign in button is disabled until both fields are filled
- Navigate to /login
- Verify Sign in button is disabled
- Fill email; verify button is still disabled
- Fill password; verify button is now enabled
TC_UI_004 — Layout is responsive on mobile
- Set viewport to 375x667 (iPhone)
- Navigate to /login
- Verify all fields stack vertically and are visible without horizontal scroll
Functional Test Cases
TC_FN_001 — Successful login with valid credentials
- Navigate to /login
- Enter
admin@example.comas email - Enter
Sup3rSecret!as password - Click "Sign in"
- Verify redirect to /dashboard and welcome message displays user name
TC_FN_002 — Failed login with wrong password
- Enter valid email and wrong password
- Click "Sign in"
- Verify error message: Invalid email or password
- Verify user remains on /login
TC_FN_003 — Login is case-insensitive for email
- Enter
ADMIN@EXAMPLE.COMwith correct password - Verify login succeeds (emails are case-insensitive)
TC_FN_004 — Remember me keeps user logged in
- Check "Remember me" and login successfully
- Close and re-open browser
- Navigate to /dashboard and verify user is still logged in
Validation Test Cases
TC_VAL_001 — Empty email field shows required error
Leave email empty, click Sign in, verify error: Email is required.
TC_VAL_002 — Invalid email format shows format error
Enter not-an-email, click Sign in, verify error: Please enter a valid email address.
TC_VAL_003 — Empty password field shows required error
Enter valid email, leave password empty, click Sign in, verify error: Password is required.
TC_VAL_004 — SQL injection in email field is rejected
Enter ' OR '1'='1 as email and any password. Verify error message (no SQL executed).
TC_VAL_005 — XSS in email field is sanitized
Enter <script>alert('xss')</script> as email. Verify error message (script not executed).
Security Test Cases
TC_SEC_001 — Rate limiting after 5 failed attempts
Enter wrong password 5 times; verify account is temporarily locked and rate-limit message displayed.
TC_SEC_002 — Password field has correct autocomplete
Inspect password field; verify autocomplete="current-password" is set (or off for high security).
TC_SEC_003 — HTTPS is enforced
Navigate to http://example.com/login; verify redirect to https://example.com/login.
TC_SEC_004 — Session token is set with HttpOnly and Secure flags
Login successfully, inspect cookies in DevTools, verify session cookie has HttpOnly and Secure flags.
TC_SEC_005 — Login response doesn't leak which field is wrong
Enter valid email + wrong password and verify error: Invalid email or password (NOT Wrong password). This prevents email enumeration attacks.
For more secure-by-design patterns, see our Security Testing for QA guide.
Accessibility Test Cases
TC_A11Y_001 — All form fields have associated labels
Inspect email field; verify <label for="email"> exists.
TC_A11Y_002 — Tab order is logical
Press Tab repeatedly; verify focus order: email → password → remember me → sign in.
TC_A11Y_003 — Screen reader announces field labels
Focus email field with screen reader enabled; verify it announces Email, edit text.
TC_A11Y_004 — Error messages have role="alert"
Trigger a validation error; inspect error element and verify role="alert" is set.
Performance Test Cases
TC_PERF_001 — Login page loads in under 2 seconds
- Clear cache
- Navigate to /login
- Measure load time
- Verify load completes in < 2000ms
For load and stress patterns on the auth endpoint, see k6 vs JMeter.
How to Write a Test Case (Template)
TC_ID: TC_FN_001
Title: Successful login with valid credentials
Preconditions: User account exists; user is logged out
Priority: High
Linked Requirement: REQ-AUTH-001
Steps:
1. Navigate to /login
2. Enter "admin@example.com" as email
3. Enter "Sup3rSecret!" as password
4. Click "Sign in"
Expected Result: User is redirected to /dashboard with welcome messageHow to Prioritize Test Cases for Execution
Not all test cases are equal. Use this priority framework:
P0 — Critical (must pass before every release)
- TC_FN_001 (successful login)
- TC_SEC_003 (HTTPS enforced)
- TC_SEC_004 (HttpOnly cookies)
P1 — High (run on every build)
- TC_FN_002 (failed login)
- TC_VAL_001 / TC_VAL_003 (required fields)
- TC_SEC_001 (rate limiting)
P2 — Medium (run on every PR)
- TC_UI_001–004 (UI rendering)
- TC_FN_003 / TC_FN_004 (case-insensitive email, remember me)
- TC_VAL_002 / TC_VAL_004–005 (validation edge cases)
P3 — Low (run weekly or pre-release)
- TC_A11Y_001–004 (accessibility)
- TC_PERF_001 (performance)
This prioritization helps you build a fast smoke suite (P0+P1) that runs in < 5 minutes, plus a deeper regression that runs nightly. For more, see our Manual Testing Complete Guide and the ISTQB Foundation Study Guide.
Continue your learning
2026 login test coverage — passkeys, MFA fallback and bot defense
The login page in 2026 is no longer a username + password form. Any modern coverage set has to include passkeys (WebAuthn), magic-link + OTP fallback, bot / credential-stuffing defense and session hygiene. Add these 12 cases to any classic login suite:
- Passkey enrol on a Chrome desktop then login on iOS Safari (cross-device).
- Passkey enrol succeeds, browser storage cleared → fallback to email OTP works.
- Magic link is single-use and expires after 10 minutes.
- Magic link opened in a different browser than requested rejects with clear copy.
- OTP is rate-limited to 5 attempts per 15 min per email.
- OTP is rate-limited per IP to defeat credential stuffing.
- Login triggers device fingerprint check; new device sends verification email.
- Session cookie is HttpOnly, Secure, SameSite=Lax and 24h max age.
- Refresh token rotation invalidates the previous token.
- Concurrent login on 5+ devices does not silently drop older sessions unless policy says so.
- Password reset link cannot be reused after successful reset.
- Login page is behind a CAPTCHA-less bot defense (e.g. Cloudflare Turnstile) that does not block accessibility users.
Automate 1, 3, 5, 8, 9, 11 in Playwright with the real WebAuthn virtual-authenticator API; leave 2, 4, 7, 12 for a manual exploratory charter each release.
Frequently asked questions
1.How many test cases should a login page have?
2.What is the most important test case for login?
3.How do you test the Forgot password link?
4.What tools should I use to test login pages?
5.Should login test cases be automated?
Practice these questions
Run a live QA mock interview tailored to this topic and get per-skill scoring in minutes.
Was this article helpful?
More from Manual Testing Basics
Test types, defect lifecycle, exploratory testing.
- Career & Interview PrepThe Honest Truth About Manual Testing Salaries in 2026 (Real Data)
- Manual TestingTest Pyramid 2026 — The 70/20/10 Rule Senior QAs Actually Ship
- Manual Testing30 SQL Queries Every QA Tester Uses in 2026 (Free Cheatsheet)
Keep building your QA edge
Pillar guides- Manual Testing Complete Guidecomplete manual testing guide for beginnersEnd-to-end manual testing tutorial — techniques, test cases, bug reports, exploratory charters.
- Manual Testing Interview Q&ASoftwareTestPilot's manual QA interview library150+ manual testing interview questions with model answers, from freshers to leads.
- QA & Testing GlossaryQA terminology explained in plain English500+ software testing terms defined — from ISTQB vocabulary to CI/CD, AI testing, and framework jargon.
- QA Practice HubQA practice hubHands-on labs — Selenium, Playwright, API, SQL exercises with sample apps and solution walkthroughs.
Continue reading
Related concepts, tools & standards around Manual Testing
A quick reference of the people, companies, frameworks and technologies most often mentioned alongside Manual Testing in real QA teams — useful when you're mapping a learning path, preparing for interviews, or scoping a new project.
Join the QA Community
Connect with fellow testers, share job leads, and get career advice.



Discussion
Ask a question, share your experience, or correct us. Be kind — real people are reading.