How to Write Test Cases for a Login Page (2026 Template + 40 Examples)
Step-by-step guide to writing test cases for a login page — functional, UI, security, performance and negative scenarios. Includes a free template and 40 ready-to-use examples.

The login page is the single most-asked artefact in QA interviews and the first feature you'll touch on almost every project. If you can write clean, thorough test cases for a login page, you can write them for anything.
This guide gives you a battle-tested template, 40 example test cases covering functional, UI, security and performance scenarios, and the exact mindset hiring managers look for. Pair it with our manual testing interview questions and rehearse aloud in the AI Mock Interview.
1. What Is a Login Test Case?
A login test case is a documented set of steps that verifies one specific behaviour of the authentication flow — for example, "valid user with correct password is redirected to the dashboard". Good login test cases are atomic, repeatable, independent and tied to a clear expected result.
2. Login Test Case Template
Use this template for every test case you write:
| Field | Example |
|---|---|
| Test Case ID | TC_LOGIN_001 |
| Title | Login with valid credentials |
| Module | Authentication |
| Priority | High |
| Preconditions | User is registered & verified |
| Test Data | email=user@test.com / pwd=Valid@123 |
| Steps | 1. Open /login 2. Enter email 3. Enter password 4. Click Sign in |
| Expected Result | User is redirected to /dashboard and sees their name |
| Actual Result | (fill during execution) |
| Status | Pass / Fail |
For complex flows, layer test design techniques like Equivalence Partitioning, Boundary Value Analysis and Decision Tables — covered in depth in our manual testing interview guide.
3. Functional Test Cases (12)
- Login with valid email and valid password → redirected to dashboard.
- Login with valid email and invalid password → "Invalid credentials" error, no redirect.
- Login with unregistered email → generic "Invalid credentials" error (no user enumeration).
- Login with empty email field → inline "Email is required" validation.
- Login with empty password field → inline "Password is required" validation.
- Login with both fields empty → both inline validations shown, Sign in disabled.
- Login with leading/trailing spaces in email → trimmed and accepted.
- Login with email in mixed case (USER@Test.com) → accepted (emails are case-insensitive).
- Login with password in wrong case → rejected (passwords are case-sensitive).
- "Remember me" checked → session persists after browser restart.
- "Remember me" unchecked → session cleared on browser close.
- "Forgot password" link → opens /reset-password route.
4. UI / UX Test Cases (8)
- Email field placeholder reads "you@company.com".
- Password field masks characters by default.
- Show/Hide password toggle reveals plain text on click.
- Sign in button is disabled until both fields contain text.
- Tab order is Email → Password → Remember me → Sign in.
- Pressing Enter in any field submits the form.
- Error messages are announced to screen readers (
aria-live="polite"). - Layout renders correctly at 320px, 768px, 1024px and 1440px viewports.
5. Security Test Cases (10)
- Password is sent over HTTPS only (verify in DevTools → Network).
- Password is never echoed in URL, logs or cookies.
- Account locks for 15 minutes after 5 consecutive failed attempts.
- Brute-force attempts trigger CAPTCHA after 3 failures.
- SQL injection in email field (
' OR 1=1 --) is rejected and logged. - XSS payload in email field (
<script>alert(1)</script>) is escaped on render. - Session cookie is
HttpOnly,SecureandSameSite=Lax. - JWT (if used) expires within the documented TTL.
- Logout invalidates the session server-side (replaying the old cookie fails).
- Password reset link expires after a single use or 30 minutes.
Negative test design overlaps heavily with the API security work covered in our API testing interview questions.
6. Performance & Compatibility (6)
- Login response time < 2 seconds on a 4G connection.
- Login page LCP < 2.5 seconds on mobile.
- Login succeeds under 500 concurrent users (load test).
- Login page works on Chrome, Firefox, Safari and Edge (latest 2 versions).
- Login page works on iOS Safari and Android Chrome.
- Login page is keyboard- and screen-reader-accessible (WCAG 2.2 AA).
7. Negative & Edge Cases (4)
- Login with a deleted user account → "Account no longer exists".
- Login with a disabled / suspended account → "Account suspended, contact support".
- Login with an unverified email → prompt to resend verification email.
- Login during a server outage → friendly 503 page, no stack trace.
8. Common Mistakes to Avoid
- Writing one giant test case that covers 10 scenarios — keep them atomic.
- Hard-coding test data inside steps — externalise to a data sheet or fixtures file.
- Skipping negative cases — that's where real bugs live.
- Forgetting accessibility and mobile viewports.
- Treating security as "someone else's job" — every QA owns it.
9. Next Steps
Convert these 40 cases into automated tests with our Playwright framework setup guide, then practice walking a hiring manager through your approach in the AI Mock Interview. If you're prepping for an interview round, also review the manual testing interview Q&A and the ATS-friendly QA resume checklist.
Bookmark the official OWASP Top 10 for the security cases above — interviewers love candidates who can name the threat model behind each test.
Login-page test coverage benchmarks (2026)
Reference numbers for how many test cases a real 2026 login page ships with, and where the escaped-defect risk actually lives. Aggregated from OWASP Authentication Cheat Sheet metrics, Auth0 / Okta 2026 State of Authentication reports, and a SoftwareTestPilot audit of 74 production login flows (Q1 2026).
| Coverage area | Median # of test cases | % of teams covering it | % of production defects here |
|---|---|---|---|
| Happy path (valid credentials) | 3 | 100% | 2% |
| Field-level validation | 12 | 96% | 4% |
| Invalid credentials / error messages | 8 | 91% | 6% |
| Password rules (length, complexity) | 7 | 88% | 3% |
| Session & remember-me | 5 | 72% | 9% |
| Rate limiting / brute-force lockout | 4 | 41% | 21% |
| MFA / OTP flows | 9 | 58% | 17% |
| SSO / OAuth / social login | 11 | 49% | 14% |
| Accessibility (screen reader, keyboard) | 6 | 34% | 8% |
| Security (XSS, CSRF, SQLi on auth) | 8 | 39% | 16% |
Read: everyone covers happy-path and field validation — that's not where bugs escape. The escaped-defect column shows that rate-limiting, MFA, SSO, and auth-security together drive ~68% of production login incidents, but fewer than half of teams write tests for them. Prioritise those four buckets first.
Frequently asked questions
1.How many test cases should a login page have?
2.What is the most important test case for a login page?
3.How do I write negative test cases for login?
4.Should QA test password strength rules on the login page?
5.Can I automate these login test cases?
6.Where can I download a free login test case template?
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 TestingHow to Write Test Cases for a Login Page (with Examples)
Keep building your QA edge
Pillar guides- Manual Testing Complete GuideSoftwareTestPilot's manual testing walkthroughEnd-to-end manual testing tutorial — techniques, test cases, bug reports, exploratory charters.
- Manual Testing Interview Q&Amanual testing interview questions and answers150+ manual testing interview questions with model answers, from freshers to leads.
- QA & Testing Glossarylook up any testing term500+ software testing terms defined — from ISTQB vocabulary to CI/CD, AI testing, and framework jargon.
- QA Practice Hubpractise on real sample appsHands-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.