Testing fundamentals

Test Cases for a Login Page: 40 Examples (Functional, Negative, Security, UI)

Robonito TeamRobonito Team 12 min read
Test Cases for a Login Page: 40 Examples (Functional, Negative, Security, UI)

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.

GroupCasesWhat it proves
FunctionalLG-01 to LG-08Valid users get in and out correctly
NegativeLG-09 to LG-16Bad input is rejected with clear errors
SecurityLG-17 to LG-25Attackers cannot guess, enumerate or hijack
UI and accessibilityLG-26 to LG-31Everyone can use the form, including keyboard and screen reader users
SSO and MFALG-32 to LG-36Third-party login and second factors work and fail safely
MobileLG-37 to LG-40Login 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.

IDScenarioStepsExpected resultType
LG-01Valid loginEnter registered email and correct password, click Sign inUser lands on dashboard (or the page they came from); name or avatar shownFunctional
LG-02Login with Enter keyFill both fields, press Enter in password fieldSame as LG-01; form submits without clicking the buttonFunctional
LG-03Email is case-insensitiveLog in with USER@Example.com for account user@example.comLogin succeedsFunctional
LG-04Password is case-sensitiveLog in with correct password in wrong caseLogin fails with generic errorFunctional
LG-05Remember meTick "Remember me", log in, close browser, reopen siteUser still logged in for the documented periodFunctional
LG-06Without remember meLog in without ticking, close browser fully, reopenUser must log in againFunctional
LG-07Redirect after loginWhile logged out, open a deep link such as /reports/42, log inUser lands on /reports/42, not the default homeFunctional
LG-08LogoutLog in, click Log out, press browser BackLogin page shown; Back does not reveal account pages; refresh asks for loginFunctional

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.

IDScenarioStepsExpected resultType
LG-09Wrong passwordRegistered email, wrong passwordGeneric error such as "Invalid email or password"; fields not cleared except passwordNegative
LG-10Unregistered emailEmail with no account, any passwordSame generic message as LG-09Negative
LG-11Both fields emptyClick Sign in with nothing enteredInline "required" messages on both fields; no request sentNegative
LG-12Password emptyEnter email only, submit"Password is required" on the password fieldNegative
LG-13Invalid email formatEnter user@, submitFormat error, or generic login failure; no server errorNegative
LG-14Leading or trailing spaces in emailEnter user@example.com with correct passwordSpaces trimmed and login succeeds, or a clear error (document which)Negative
LG-15Very long inputPaste 5,000 characters into each fieldGraceful rejection or failure message; no crash or 500 pageNegative
LG-16Deactivated accountCorrect credentials for a disabled accountLogin refused; message does not confirm the account exists unless policy allowsNegative

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.

IDScenarioStepsExpected resultType
LG-17No user enumeration in messageCompare LG-09 and LG-10 responsesIdentical message text and HTTP status codeSecurity
LG-18No user enumeration by timingTime 20 failed logins for a real email vs a fake oneResponse times are similar; no fast exit for unknown usersSecurity
LG-19Account lockout or throttlingEnter wrong password repeatedly (e.g. 5 to 10 times per your policy)Account throttled, locked or CAPTCHA shown; password reset still reachableSecurity
LG-20Rate limit across accountsScript many login attempts from one client against different emailsRequests slowed or blocked (e.g. 429); service stays upSecurity
LG-21Password maskedType in password field; inspect elementCharacters shown as dots; field is type="password"Security
LG-22HTTPS onlyOpen http:// version of login URLRedirect to https://; form never posts over plain HTTPSecurity
LG-23Session cookie flagsLog in, inspect session cookie in developer toolsSecure, HttpOnly and SameSite (Lax or Strict) setSecurity
LG-24Session ID changes on loginNote session cookie value before and after loginValue changes after login (prevents session fixation)Security
LG-25Injection in fieldsEnter ' OR '1'='1 and <script>alert(1)</script> in both fieldsLogin fails normally; no script runs; no database error shownSecurity

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?

IDScenarioStepsExpected resultType
LG-26Keyboard onlyTab through the page without a mouse, log inLogical focus order (email, password, show toggle, remember me, Sign in); visible focus ring; Enter submitsUI / Accessibility
LG-27Screen reader labelsUse a screen reader on each field and buttonEach field has an announced label (not only placeholder text); errors are announcedUI / Accessibility
LG-28Paste allowedPaste password from clipboardPaste works in email, password and code fieldsUI / Accessibility
LG-29Password manager autofillUse browser password manager to fillFields fill correctly; password field uses autocomplete="current-password"UI / Accessibility
LG-30Error message placementTrigger LG-11Errors appear next to the relevant field, in text (not color alone), and stay until fixedUI / Accessibility
LG-31Links workClick "Forgot password" and "Sign up"Each opens the correct page; Forgot password flow sends a reset emailUI

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.

IDScenarioStepsExpected resultType
LG-32SSO happy pathClick "Sign in with [provider]", approve with a test accountReturned to the app, logged in as the matching userSSO
LG-33SSO cancelledStart SSO, click Cancel or Deny at the providerReturned to login page with a clear message; not logged in; no error pageSSO
LG-34Valid TOTP codeLog in, enter current code from authenticator appAccess grantedMFA
LG-35Wrong or expired TOTP codeEnter a wrong code, then a code from several minutes agoBoth rejected with a generic message; attempts count toward lockoutMFA
LG-36Reused TOTP codeLog in with a code, log out, immediately reuse the same codeSecond use rejectedMFA

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?

IDScenarioStepsExpected resultType
LG-37Responsive layoutOpen login on a 375 px wide screenNo horizontal scroll; fields and button fully visible; tap targets easy to hitMobile
LG-38Correct keyboardTap email field on a phoneEmail keyboard (with @) shown; no auto-capitalization of the first letterMobile
LG-39App backgrounded mid-loginStart typing, switch to another app, returnEntered email kept, or form reset cleanly; no crashMobile
LG-40Network lost on submitTurn on airplane mode, tap Sign inClear offline message; no infinite spinner; retry works when onlineMobile

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:

#CaseWhy it is in the top 10
1LG-01 Valid loginIf this fails, nothing else can be tested
2LG-08 LogoutSession bugs often surface here
3LG-07 Redirect after loginBreaks quietly when routes change
4LG-09 Wrong passwordCore negative path
5LG-17 No user enumerationEasy to regress when someone "improves" an error message
6LG-19 Lockout or throttlingConfig changes can switch it off unnoticed
7LG-22 HTTPS onlyInfrastructure changes can break redirects
8LG-23 Session cookie flagsFramework upgrades can change defaults
9LG-32 SSO happy pathProvider changes break it without code changes on your side
10LG-34 Valid TOTP codeMost 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 .

Free whitepaperThe Agentic QA PlaybookMove from test scripts to AI agents in 90 days, with the controls, metrics and a 25-question vendor checklist.

No-code AI test automation

Spend less time testing and more time shipping.

3Pillar showed Robonito's agents to its own client live, and that client is now onboarding. Start on the Free plan, which stays free forever, or book a demo and we'll walk through your own app.

Newsletter

Get new posts by email

Practical guides on software testing, QA automation and AI agents. One email when we publish, no spam.

We'll send a confirmation email first. Your details are stored with Mailchimp, our email provider.

All blog posts