A login page looks like the smallest screen in the app: two fields and a button. Then someone asks what happens after five wrong passwords, whether the error message gives away which emails are registered, whether the session cookie is marked Secure, and whether a screen reader can find the "Show password" toggle. Suddenly the smallest screen has the most test cases.
Most lists online stop at "valid username, valid password" and "invalid password." This one goes further.
Updated December 2026
Test cases for a login page should cover six areas: functional (valid login, remember me, logout), negative (wrong or empty credentials), security (lockout, rate limiting, no user enumeration, HTTPS, cookie flags), UI and accessibility, SSO and MFA, and mobile. Below are 40 cases with steps and expected results, plus a CSV you can import.
Key takeaways
- A complete set of login page test cases has about 40 cases across six groups. Security cases matter as much as functional ones.
- Error messages must be generic. "Invalid email or password" for every failure, so attackers cannot learn which accounts exist.
- Pasting and password managers must work. Blocking them hurts users and can fail WCAG 2.2.
- Automate the top 10 as a regression suite that runs on every build; keep rare edge cases manual.
What should test cases for login page forms cover?
Login is the front door, so it gets tested from three angles: does it let the right people in, does it keep the wrong people out, and can everyone use it. That splits naturally into six groups.
| Group | Cases | What it proves |
|---|---|---|
| Functional | LG-01 to LG-08 | Valid users get in and out correctly |
| Negative | LG-09 to LG-16 | Bad input is rejected with clear errors |
| Security | LG-17 to LG-25 | Attackers cannot guess, enumerate or hijack |
| UI and accessibility | LG-26 to LG-31 | Everyone can use the form, including keyboard and screen reader users |
| SSO and MFA | LG-32 to LG-36 | Third-party login and second factors work and fail safely |
| Mobile | LG-37 to LG-40 | Login works on phones, in apps and across interruptions |
Not every app needs all 40 test cases for login page checks. If you have no SSO, drop that group. If you have no mobile app, keep only the responsive web cases. Adjust the limits (attempt counts, timeouts, password length) to your own requirements.
The security cases here draw on the OWASP Authentication Cheat Sheet and Session Management Cheat Sheet, two widely used public references for this.
What are the functional test cases for a login page?
These are the positive login test cases: the flows that must work for every user, every release.
| ID | Scenario | Steps | Expected result | Type |
|---|---|---|---|---|
| LG-01 | Valid login | Enter registered email and correct password, click Sign in | User lands on dashboard (or the page they came from); name or avatar shown | Functional |
| LG-02 | Login with Enter key | Fill both fields, press Enter in password field | Same as LG-01; form submits without clicking the button | Functional |
| LG-03 | Email is case-insensitive | Log in with USER@Example.com for account user@example.com | Login succeeds | Functional |
| LG-04 | Password is case-sensitive | Log in with correct password in wrong case | Login fails with generic error | Functional |
| LG-05 | Remember me | Tick "Remember me", log in, close browser, reopen site | User still logged in for the documented period | Functional |
| LG-06 | Without remember me | Log in without ticking, close browser fully, reopen | User must log in again | Functional |
| LG-07 | Redirect after login | While logged out, open a deep link such as /reports/42, log in | User lands on /reports/42, not the default home | Functional |
| LG-08 | Logout | Log in, click Log out, press browser Back | Login page shown; Back does not reveal account pages; refresh asks for login | Functional |
What are the negative test cases for a login page?
Negative login test cases check that every wrong input is rejected safely. Our sibling post on negative testing covers the techniques behind these and 30 more examples beyond login.
| ID | Scenario | Steps | Expected result | Type |
|---|---|---|---|---|
| LG-09 | Wrong password | Registered email, wrong password | Generic error such as "Invalid email or password"; fields not cleared except password | Negative |
| LG-10 | Unregistered email | Email with no account, any password | Same generic message as LG-09 | Negative |
| LG-11 | Both fields empty | Click Sign in with nothing entered | Inline "required" messages on both fields; no request sent | Negative |
| LG-12 | Password empty | Enter email only, submit | "Password is required" on the password field | Negative |
| LG-13 | Invalid email format | Enter user@, submit | Format error, or generic login failure; no server error | Negative |
| LG-14 | Leading or trailing spaces in email | Enter user@example.com with correct password | Spaces trimmed and login succeeds, or a clear error (document which) | Negative |
| LG-15 | Very long input | Paste 5,000 characters into each field | Graceful rejection or failure message; no crash or 500 page | Negative |
| LG-16 | Deactivated account | Correct credentials for a disabled account | Login refused; message does not confirm the account exists unless policy allows | Negative |
What security test cases does a login page need?
This is where most published login page test cases are thin, and where the real risk sits. Several of these need a browser's developer tools to check.
| ID | Scenario | Steps | Expected result | Type |
|---|---|---|---|---|
| LG-17 | No user enumeration in message | Compare LG-09 and LG-10 responses | Identical message text and HTTP status code | Security |
| LG-18 | No user enumeration by timing | Time 20 failed logins for a real email vs a fake one | Response times are similar; no fast exit for unknown users | Security |
| LG-19 | Account lockout or throttling | Enter wrong password repeatedly (e.g. 5 to 10 times per your policy) | Account throttled, locked or CAPTCHA shown; password reset still reachable | Security |
| LG-20 | Rate limit across accounts | Script many login attempts from one client against different emails | Requests slowed or blocked (e.g. 429); service stays up | Security |
| LG-21 | Password masked | Type in password field; inspect element | Characters shown as dots; field is type="password" | Security |
| LG-22 | HTTPS only | Open http:// version of login URL | Redirect to https://; form never posts over plain HTTP | Security |
| LG-23 | Session cookie flags | Log in, inspect session cookie in developer tools | Secure, HttpOnly and SameSite (Lax or Strict) set | Security |
| LG-24 | Session ID changes on login | Note session cookie value before and after login | Value changes after login (prevents session fixation) | Security |
| LG-25 | Injection in fields | Enter ' OR '1'='1 and <script>alert(1)</script> in both fields | Login fails normally; no script runs; no database error shown | Security |
A few notes on these:
- LG-17 and LG-18. OWASP recommends a generic message whether the user ID or the password was wrong, and says response time and status codes should not reveal whether an account exists either.
- LG-19. OWASP suggests counting failures per account, not per IP address, and keeping password recovery available during lockout so lockout cannot be used to deny service.
- LG-21. MDN describes the password input as obscuring the text, usually with dots or asterisks. A "Show password" toggle is fine; check it starts hidden.
- LG-23 and LG-24. The OWASP Session Management Cheat Sheet recommends all three cookie attributes and regenerating the session ID on login.
These are functional checks of security behavior. They do not replace a penetration test.
What UI and accessibility test cases apply to a login page?
| ID | Scenario | Steps | Expected result | Type |
|---|---|---|---|---|
| LG-26 | Keyboard only | Tab through the page without a mouse, log in | Logical focus order (email, password, show toggle, remember me, Sign in); visible focus ring; Enter submits | UI / Accessibility |
| LG-27 | Screen reader labels | Use a screen reader on each field and button | Each field has an announced label (not only placeholder text); errors are announced | UI / Accessibility |
| LG-28 | Paste allowed | Paste password from clipboard | Paste works in email, password and code fields | UI / Accessibility |
| LG-29 | Password manager autofill | Use browser password manager to fill | Fields fill correctly; password field uses autocomplete="current-password" | UI / Accessibility |
| LG-30 | Error message placement | Trigger LG-11 | Errors appear next to the relevant field, in text (not color alone), and stay until fixed | UI / Accessibility |
| LG-31 | Links work | Click "Forgot password" and "Sign up" | Each opens the correct page; Forgot password flow sends a reset email | UI |
LG-28 and LG-29 are not just convenience. The W3C's WCAG 2.2 success criterion 3.3.8, Accessible Authentication (Minimum), a Level AA requirement, names password manager support and copy and paste as ways to meet it. OWASP's cheat sheet also says to allow pasting into username, password and MFA fields.
For more layout and visual checks, see our UI test cases for web apps.
What test scenarios for login page SSO and MFA should you include?
If your login offers "Sign in with Google" or "Sign in with Microsoft", or asks for a second factor, these test scenarios for login page flows matter most. They also break most often in automation.
| ID | Scenario | Steps | Expected result | Type |
|---|---|---|---|---|
| LG-32 | SSO happy path | Click "Sign in with [provider]", approve with a test account | Returned to the app, logged in as the matching user | SSO |
| LG-33 | SSO cancelled | Start SSO, click Cancel or Deny at the provider | Returned to login page with a clear message; not logged in; no error page | SSO |
| LG-34 | Valid TOTP code | Log in, enter current code from authenticator app | Access granted | MFA |
| LG-35 | Wrong or expired TOTP code | Enter a wrong code, then a code from several minutes ago | Both rejected with a generic message; attempts count toward lockout | MFA |
| LG-36 | Reused TOTP code | Log in with a code, log out, immediately reuse the same code | Second use rejected | MFA |
LG-35 and LG-36 come from the TOTP standard itself. RFC 6238 uses a 30-second time step by default, recommends allowing at most a small window for network delay and clock drift, and says the verifier must not accept the same one-time password twice.
Automating TOTP is a common blocker. Our guide on how to automate TOTP authentication tests walks through generating codes from the shared secret at run time and handling clock drift in CI.
What mobile login test cases should you add?
| ID | Scenario | Steps | Expected result | Type |
|---|---|---|---|---|
| LG-37 | Responsive layout | Open login on a 375 px wide screen | No horizontal scroll; fields and button fully visible; tap targets easy to hit | Mobile |
| LG-38 | Correct keyboard | Tap email field on a phone | Email keyboard (with @) shown; no auto-capitalization of the first letter | Mobile |
| LG-39 | App backgrounded mid-login | Start typing, switch to another app, return | Entered email kept, or form reset cleanly; no crash | Mobile |
| LG-40 | Network lost on submit | Turn on airplane mode, tap Sign in | Clear offline message; no infinite spinner; retry works when online | Mobile |
For native apps, add biometric login (Face ID, fingerprint) cases if you support them, including the fallback to password when biometrics fail.
Where can I get these login test cases as a CSV?
Copy the block below into a .csv file. It opens in Excel or Google Sheets and most test management tools can import it. Column names follow a common import format; rename them to match your tool.
ID,Group,Scenario,Steps,Expected Result,Type,Priority
LG-01,Functional,Valid login,"Enter registered email and correct password; click Sign in","Lands on dashboard or original page; user shown",Positive,P1
LG-02,Functional,Login with Enter key,"Fill both fields; press Enter","Same as LG-01",Positive,P2
LG-03,Functional,Email case-insensitive,"Log in with upper-case variant of email","Login succeeds",Positive,P2
LG-04,Functional,Password case-sensitive,"Enter correct password in wrong case","Generic error; not logged in",Negative,P2
LG-05,Functional,Remember me,"Tick Remember me; log in; close and reopen browser","Still logged in for documented period",Positive,P2
LG-06,Functional,Without remember me,"Log in without ticking; close browser fully; reopen","Must log in again",Positive,P3
LG-07,Functional,Redirect after login,"Open deep link while logged out; log in","Lands on deep link",Positive,P2
LG-08,Functional,Logout,"Log in; log out; press Back; refresh","Account pages not shown; login required",Positive,P1
LG-09,Negative,Wrong password,"Registered email + wrong password","Generic error message",Negative,P1
LG-10,Negative,Unregistered email,"Unknown email + any password","Same generic message as LG-09",Negative,P1
LG-11,Negative,Both fields empty,"Click Sign in with empty fields","Required messages on both fields; no request sent",Negative,P2
LG-12,Negative,Password empty,"Enter email only; submit","Password required message",Negative,P2
LG-13,Negative,Invalid email format,"Enter user@; submit","Format error or generic failure; no 500",Negative,P3
LG-14,Negative,Spaces around email,"Enter email with leading/trailing spaces","Trimmed and succeeds, or clear error",Negative,P3
LG-15,Negative,Very long input,"Paste 5000 characters into each field","Graceful rejection; no crash",Negative,P3
LG-16,Negative,Deactivated account,"Correct credentials for disabled account","Login refused; no account disclosure",Negative,P2
LG-17,Security,No enumeration by message,"Compare LG-09 and LG-10 responses","Identical text and status code",Security,P1
LG-18,Security,No enumeration by timing,"Time failed logins for real vs fake email","Similar response times",Security,P2
LG-19,Security,Lockout or throttling,"Wrong password repeatedly per policy","Throttled/locked/CAPTCHA; reset still reachable",Security,P1
LG-20,Security,Rate limit across accounts,"Many attempts from one client to different emails","Slowed or blocked (e.g. 429); service up",Security,P2
LG-21,Security,Password masked,"Type password; inspect element","Dots shown; type=password",Security,P1
LG-22,Security,HTTPS only,"Open http:// login URL","Redirect to https://",Security,P1
LG-23,Security,Session cookie flags,"Log in; inspect session cookie","Secure; HttpOnly; SameSite set",Security,P1
LG-24,Security,Session ID changes on login,"Compare session cookie before and after login","Value changes",Security,P2
LG-25,Security,Injection in fields,"Enter SQL and script payloads in both fields","Normal failure; no script runs; no DB error",Security,P1
LG-26,UI/Accessibility,Keyboard only,"Tab through page; log in with keyboard","Logical focus order; visible focus; Enter submits",Accessibility,P2
LG-27,UI/Accessibility,Screen reader labels,"Use screen reader on fields and errors","Labels and errors announced",Accessibility,P2
LG-28,UI/Accessibility,Paste allowed,"Paste into email/password/code fields","Paste works",Accessibility,P2
LG-29,UI/Accessibility,Password manager autofill,"Fill with browser password manager","Fields fill; autocomplete=current-password",Accessibility,P2
LG-30,UI/Accessibility,Error placement,"Trigger empty-field errors","Errors next to fields; text not color only",UI,P3
LG-31,UI,Links work,"Click Forgot password and Sign up","Correct pages open; reset email sent",UI,P2
LG-32,SSO,SSO happy path,"Sign in with provider using test account","Logged in as matching user",SSO,P1
LG-33,SSO,SSO cancelled,"Start SSO; cancel at provider","Back on login page with message; not logged in",SSO,P2
LG-34,MFA,Valid TOTP code,"Log in; enter current authenticator code","Access granted",MFA,P1
LG-35,MFA,Wrong or expired TOTP,"Enter wrong code; then old code","Both rejected; count toward lockout",MFA,P1
LG-36,MFA,Reused TOTP,"Reuse a code that already worked","Rejected",MFA,P2
LG-37,Mobile,Responsive layout,"Open login at 375 px width","No horizontal scroll; all controls visible",Mobile,P2
LG-38,Mobile,Correct keyboard,"Tap email field on phone","Email keyboard; no auto-capitalization",Mobile,P3
LG-39,Mobile,App backgrounded,"Start typing; switch apps; return","Input kept or clean reset; no crash",Mobile,P3
LG-40,Mobile,Network lost on submit,"Airplane mode; tap Sign in","Offline message; retry works",Mobile,P2
The Priority column is a starting point. A banking app would move most security cases to P1; an internal tool might drop timing checks to P3.
How do you automate login test cases as a regression suite?
You do not need to automate all 40 test cases for login page coverage. Pick the ten that break most often and cost the most when they do, and run them on every build. A practical top 10:
| # | Case | Why it is in the top 10 |
|---|---|---|
| 1 | LG-01 Valid login | If this fails, nothing else can be tested |
| 2 | LG-08 Logout | Session bugs often surface here |
| 3 | LG-07 Redirect after login | Breaks quietly when routes change |
| 4 | LG-09 Wrong password | Core negative path |
| 5 | LG-17 No user enumeration | Easy to regress when someone "improves" an error message |
| 6 | LG-19 Lockout or throttling | Config changes can switch it off unnoticed |
| 7 | LG-22 HTTPS only | Infrastructure changes can break redirects |
| 8 | LG-23 Session cookie flags | Framework upgrades can change defaults |
| 9 | LG-32 SSO happy path | Provider changes break it without code changes on your side |
| 10 | LG-34 Valid TOTP code | Most likely to be skipped, most painful to discover broken |
Tips that keep this suite stable:
- Use dedicated test accounts, one per test that changes account state. Lockout tests (LG-19) will lock the account, so do not share it with LG-01.
- Reset state between runs. Clear the lockout through an API or admin call before the test, not by waiting for the timer.
- Generate TOTP codes in the test, from a test account's shared secret, rather than asking someone to read a phone. The TOTP automation guide shows how.
- Use the provider's test tenant for SSO, never a real employee account.
- Check cookies and redirects at the HTTP level where your tool allows it. It is faster and less flaky than checking them through the UI.
Put this suite in your CI pipeline next to your other automated regression tests. If you are still deciding what else belongs in the pipeline, our web application testing checklist is a good place to start.
Can Robonito automate login page tests?
Robonito is an agentic QA platform: AI agents create, run and maintain end-to-end tests. For login tests specifically:
Where it fits:
- Fast first draft. In AI Studio you describe what to test in plain English or paste the login URL, and the agent works through the app step by step. It can also generate tests from requirement documents and Jira stories, so a login story with acceptance criteria can become a set of draft test cases for your team to review.
- Less upkeep when the page changes. Login pages get redesigned often. Self-healing steps adapt when labels, layouts or locators change, and healed steps are logged for review.
- Evidence when a run fails. Every run keeps video, network traces and an AI root cause for failures.
- Pipeline runs. CI/CD integration (Jenkins, GitHub Actions, GitLab CI, Azure DevOps, CircleCI) is on Starter and above. Mobile app testing (Android and iOS) is on Pro and Enterprise.
Where it does not fit:
- Robonito is not a test management tool. Import the CSV above into TestRail, Zephyr or Xray (all of which Robonito integrates with) or your own tool to track the cases.
- It is not an accessibility scanner. Cases LG-26 to LG-30 still need a screen reader and a human, or a dedicated accessibility tool.
- Timing-based enumeration checks (LG-18) and high-volume rate limit checks (LG-20) are better done with a scripted HTTP tool than a UI test.
Web testing and plain-text test creation are on every plan, including Free. See pricing for limits.
or to see the agent build your login regression suite.
Frequently asked questions
How many test cases are needed for a login page?
A basic login form needs around 15 to 20 cases. A production login with lockout, SSO, MFA and a mobile app needs closer to 40. The list above gives 40 you can trim.
What are the positive and negative test cases for a login page?
Positive cases confirm a valid user can log in, stay logged in with "Remember me", land on the right page and log out (LG-01 to LG-08). Negative cases confirm wrong passwords, unknown emails, empty fields and disabled accounts are rejected with a generic message (LG-09 to LG-16).
What is the difference between test cases and test scenarios for a login page?
A test scenario is a short statement of what to check, such as "user cannot log in with a wrong password." A test case adds the exact steps, data and expected result. Each scenario usually has one or more test cases.
Should a login page say "wrong password" or "invalid email or password"?
"Invalid email or password," or similar. OWASP recommends one generic message for every failure so the page does not reveal which accounts exist.
Should you block copy and paste in the password field?
No. Blocking paste stops password managers and can fail WCAG 2.2 success criterion 3.3.8. OWASP also recommends allowing paste.
How do you test a login page with two-factor authentication?
Use a test account with a known TOTP secret, generate the current code inside the test, and cover valid, wrong, expired and reused codes (LG-34 to LG-36). See our TOTP automation guide for the details.
Ready to turn these login test cases into a regression suite? or .




