Test cases for a login page check five things: that the right person gets in, the wrong input is refused, attackers learn nothing, everyone can use the form, and it works on a phone. The tables below hold 56 cases with steps and expected results, and the security rules are taken from OWASP, NIST and WCAG rather than habit.
Before you copy the table
The cases share a few assumptions. Write them down in your own test case template before the first run, because a login expected result is only as exact as the policy behind it.
- Test accounts. One active account, one locked, one disabled, one awaiting email confirmation, and one with a second factor enabled, each on a test environment. Never use a real person’s credentials, and never paste a password into a ticket.
- The policy. The failure threshold and what happens after it, the session timeouts, the password length limits, whether email addresses are case-insensitive, whether spaces are trimmed. Where a case below says “per policy”, the expected result is the number in that document.
- Two views of every result. What the user sees, and what the server did: whether a session cookie was set, which status code came back, whether the failure counter moved. The browser’s developer tools show both.
The general rules for writing a case that a stranger can run are in how to write test cases. The login form is still a form, so the checks for labels, validation and submission in the form testing guide apply to it as well; this page adds what is specific to signing in.
Functional and negative test cases
Functional cases prove the happy path and what follows a successful sign-in. Negative cases prove the page refuses what it should and creates no session when it does.
| ID | Scenario | Steps | Expected result |
|---|---|---|---|
| LGN-F01 | Valid email and password | 1. Open the login page. 2. Enter the active account’s email and password. 3. Select Sign in. | Signed in and taken to the default page. Session cookie set. Login form no longer shown. |
| LGN-F02 | Enter key submits | 1. Fill both fields. 2. Press Enter in the password field. | Same result as LGN-F01. |
| LGN-F03 | Return to the requested page | 1. Signed out, open a protected URL such as /settings. 2. Sign in when redirected. | Returned to /settings, not to the default page. |
| LGN-F04 | Redirect parameter points off-site | 1. Open the login URL with the return address changed to an external domain. 2. Sign in. | Redirect refused. User stays on the site’s own domain. |
| LGN-F05 | Remember me selected | 1. Tick Remember me. 2. Sign in. 3. Close and reopen the browser. | Still signed in, for the period in the policy. |
| LGN-F06 | Remember me not selected | 1. Sign in without ticking it. 2. Close and reopen the browser. | Session behaviour matches the policy for an unremembered session. |
| LGN-F07 | Sign out, then Back | 1. Sign in. 2. Sign out. 3. Press the browser’s Back button. | Protected page not shown from cache. Reloading it asks for sign-in. |
| LGN-F08 | Already signed in, open the login page | 1. Sign in. 2. Open the login URL directly. | Taken into the app, or offered to sign out. No second login form over a live session. |
| LGN-F09 | Email typed in upper case | 1. Enter the account’s email in capitals. 2. Enter the correct password. 3. Sign in. | Matches the documented rule for email case. Record which rule applies. |
| LGN-F10 | Forgot password link | 1. Select Forgot password. | Reset page opens. The link is visible next to the password field. |
| LGN-F11 | Second factor, correct code | 1. Sign in with the account that has a second factor. 2. Enter the current code. | Access granted only after the code. No session before it. |
| LGN-F12 | Social or single sign-on button, if offered | 1. Select the provider button. 2. Complete the provider’s sign-in. | Returned signed in to the same account the provider’s email belongs to. |
| LGN-N01 | Wrong password | 1. Enter the active email and a wrong password. 2. Sign in. | Generic error. No session cookie. Failure counter increases. |
| LGN-N02 | Unknown email | 1. Enter an email with no account and any password. 2. Sign in. | Exactly the same message and status code as LGN-N01. |
| LGN-N03 | Both fields empty | 1. Select Sign in with nothing entered. | Each field shows its own error. No request reaches the server, or the server refuses it. |
| LGN-N04 | Email empty | 1. Enter only a password. 2. Sign in. | Email field error. Password field keeps its value. |
| LGN-N05 | Password empty | 1. Enter only an email. 2. Sign in. | Password field error. |
| LGN-N06 | Whitespace only | 1. Enter spaces in both fields. 2. Sign in. | Treated as empty. |
| LGN-N07 | Malformed email | 1. Enter user@ or user.example.com. 2. Sign in. | Format error on the email field, naming the expected format. |
| LGN-N08 | Password in the wrong case | 1. Enter the correct password with its case changed after the first character. 2. Sign in. | Refused, the same as LGN-N01. |
| LGN-N09 | Locked account, correct password | 1. Sign in with the locked account. | No session. Response follows the policy and does not confirm the account exists to a stranger. |
| LGN-N10 | Disabled account, correct password | 1. Sign in with the disabled account. | No session. Response follows the policy. |
| LGN-N11 | Unconfirmed account | 1. Sign in with the account awaiting email confirmation. | No access to protected pages. Prompt to confirm or resend the email. |
| LGN-N12 | Wrong or expired second-factor code | 1. Sign in with the second-factor account. 2. Enter a wrong code, then an expired one. | Refused both times. Attempts counted toward the limit. |
| LGN-N13 | Double submit | 1. Fill both fields. 2. Double-click Sign in. | One request, one session. |
LGN-N08 changes the case after the first character on purpose. NIST SP 800-63B allows a verifier to accept a password whose leading character differs in case, as a limited allowance for mistyping, so a capital first letter typed by mistake may correctly be accepted. Check the policy before filing that one.
Security test cases, with the rule behind each
These are the cases the popular lists cover least, and the ones that matter most. Each expected result comes from the OWASP Authentication Cheat Sheet or from NIST SP 800-63B (revision 4, the current version, read on 16 November 2026).
| ID | Scenario | Steps | Expected result |
|---|---|---|---|
| LGN-S01 | Page served over plain HTTP | 1. Open the login URL with http:// in place of https://. | Redirected to HTTPS before the form appears. OWASP: the login page and every authenticated page must be served only over TLS. |
| LGN-S02 | Enumeration by message | 1. Run LGN-N01 and LGN-N02. 2. Compare the text. | Identical. OWASP asks for a generic answer, in the HTML and in the HTTP response, whether the user exists or not. |
| LGN-S03 | Enumeration by status code | 1. Repeat LGN-S02 with the Network panel open. 2. Compare status codes. | Identical. OWASP notes a differing response code can leak whether an account is valid even when the page looks the same. |
| LGN-S04 | Enumeration through password reset | 1. Request a reset for a real and an unknown email. | Same message for both. OWASP applies the generic answer to login, password reset and recovery. |
| LGN-S05 | Repeated failures are limited | 1. Submit a wrong password repeatedly on one account. | Throttling starts at the documented threshold. NIST requires no more than 100 consecutive failed attempts per authenticator, and allows lower limits. |
| LGN-S06 | Lockout cannot be used against users | 1. Trigger the limit on an account from a second browser or network. 2. Try the real owner’s path. | The owner has a documented way back in. OWASP warns that a lockout design must not let an attacker lock other users out. |
| LGN-S07 | Long passphrase | 1. On a test account, set a 64-character passphrase. 2. Sign in with it. | Accepted. OWASP, citing NIST, says the maximum length should be at least 64 characters. |
| LGN-S08 | No silent truncation | 1. With the LGN-S07 account, sign in with the passphrase minus its last character. | Refused. OWASP: do not silently truncate passwords. |
| LGN-S09 | Spaces and Unicode in the password | 1. Set a password containing spaces and a non-Latin character. 2. Sign in with it. | Accepted. OWASP: allow all characters, including Unicode and whitespace. |
| LGN-S10 | Paste into every field | 1. Paste the email, the password and the second-factor code from a text editor. | Paste works in all three. OWASP asks sites to allow paste in the username, password and MFA fields. |
| LGN-S11 | Password manager fills the form | 1. Save the credentials in the browser’s password manager. 2. Return to the login page. | Both fields fill and the form submits. NIST: verifiers shall allow password managers and autofill. |
| LGN-S12 | SQL fragment in the email field | 1. Enter ’ OR ‘1’=‘1 as the email. 2. Sign in. | Generic failure. No database error or stack trace on the page. |
| LGN-S13 | Script in the email field | 1. Enter a script tag as the email. 2. Sign in. | Shown back as text, if at all. Never run. |
| LGN-S14 | Browser checks removed | 1. In DevTools, remove the field’s required and maxlength attributes. 2. Submit empty, then oversized, input. | The server refuses both. The server is the control; client-side checks only help the user. |
| LGN-S15 | Password kept out of the URL | 1. Sign in with the Network panel open. 2. Inspect the request. | Sent in the body of a POST. Never in the query string or the address bar. |
| LGN-S16 | Session identifier changes at sign-in | 1. Note the session cookie value before signing in. 2. Sign in. 3. Compare. | A new value after sign-in. The pre-login value no longer works. |
| LGN-S17 | Idle timeout | 1. Sign in. 2. Leave the session idle past the policy’s timeout. 3. Act. | Asked to sign in again. NIST’s AAL2 guidance is an inactivity timeout of no more than one hour and reauthentication at least every 24 hours. |
| LGN-S18 | Sign-out ends the session on the server | 1. Copy the session cookie. 2. Sign out. 3. Replay a request with the copied cookie. | Refused. Sign-out that only clears the browser leaves the session usable. |
Accessibility and usability test cases
A login form that cannot be completed with a keyboard or a screen reader shuts people out of the whole product. WCAG 2.2 Success Criterion 3.3.8, Accessible Authentication (Minimum), treats remembering a password as a cognitive function test, and passes a username and password form when the browser and password managers can fill it and users can paste. The usability rows come from Google’s sign-in form best practices.
| ID | Scenario | Steps | Expected result |
|---|---|---|---|
| LGN-A01 | Keyboard only | 1. Put the mouse away. 2. Tab through the form, sign in, open Forgot password. | Logical focus order, visible focus on every control, every action reachable. See keyboard navigation. |
| LGN-A02 | Labels | 1. Click each label. 2. Listen with a screen reader. | Focus moves to the field. Each field announces a visible label, not a placeholder. The W3C labels tutorial asks for a label whose for attribute matches the field’s id. |
| LGN-A03 | Error announced and tied to its field | 1. Run LGN-N01 with a screen reader on. | The error is announced and stated in text. WCAG 3.3.1 Error Identification requires the error to be described in text. |
| LGN-A04 | Field purpose in code | 1. Inspect the two inputs. | autocomplete=“username” on the email field and autocomplete=“current-password” on the password field, as web.dev recommends. |
| LGN-A05 | No puzzle without an alternative | 1. Trigger any CAPTCHA the form shows, for example after several failures. | A path that does not need the puzzle. WCAG 3.3.8 allows only object recognition or content the user supplied as exceptions. |
| LGN-A06 | Show password control | 1. Reach the toggle by keyboard. 2. Activate it. | Password shown and hidden. The control has an accessible name. The form does not submit, since web.dev notes a button inside a form defaults to type submit. |
| LGN-A07 | Error not shown by colour alone | 1. Run LGN-N03 in greyscale or with colour turned off. | The error is still clear from its text. |
| LGN-U01 | Email keyboard on a phone | 1. Tap the email field on a phone. | A keyboard with the @ sign, from type=“email”. |
| LGN-U02 | On-screen keyboard and the button | 1. Fill the password on a phone with the keyboard open. | The Sign in button is still visible or reachable. web.dev shows the keyboard hiding it on some phones. |
| LGN-U03 | Button label | 1. Read the submit button. | Says what it does, such as Sign in. Submit is too vague. |
| LGN-U04 | Button while fields are empty | 1. Load the page and look at the button before typing. | Enabled, and pressing it explains what is missing. web.dev warns against a disabled button that leaves people tapping with no explanation. |
| LGN-U05 | Slow connection | 1. Throttle the network in DevTools. 2. Sign in. | A loading state, one request, and a clear message if it times out. |
| LGN-U06 | Useful failure message | 1. Run LGN-N01. | Generic about which part was wrong, and points to Forgot password. |
Expectations the popular lists get wrong
Several widely copied login test sets carry expected results that the standards now contradict. A case built on one of them passes a broken page or fails a correct one.
- “Account locked after five attempts for 30 minutes.” A fixed number from a blog is not an expected result. NIST sets an upper bound of 100 consecutive failures and suggests waits that grow as the account nears the limit, for example from 30 seconds up to an hour. OWASP describes exponential lockout as an option and warns about lockout used as denial of service. Test the threshold your policy states.
- Rejecting a password at sign-in for lacking a symbol or a digit. NIST says other composition requirements shall not be imposed beyond the blocklist, and OWASP says there should be no composition rules limiting the type of characters. A login form has no business validating password strength at all; that belongs to the page where a password is set.
- Expecting paste to be blocked. A case like that is a bug report against the standards. NIST says verifiers should permit paste, OWASP asks for it in every login field, and WCAG 3.3.8 fails a form that blocks password managers or paste without an alternative.
- Treating space-trimming as a defect. NIST allows a verifier to remove leading and trailing whitespace before checking, as long as the result still meets the minimum length. The expected result is the documented rule, applied the same way at sign-up and sign-in.
- Forcing a periodic password change at login. OWASP advises against requiring periodic changes and notes that NIST guidance says verifiers should not mandate arbitrary ones. A prompt to change a password that nobody suspects is compromised counts as a finding.
The form testing guide covers the checks every form shares, and web application testing places sign-in among the other layers of a release.
What to attach when a login case fails
A failed login case is reported with the case ID, the test account’s name (never its password), the browser, the exact message shown and a screenshot. Add the expected and actual result side by side, and for the security rows the evidence that decides them: the two status codes for an enumeration case, the request method for LGN-S15, the cookie values for LGN-S16.
Be careful with network exports. A HAR file saved from a login attempt contains the posted form data, which is the password, and the session cookies set after it. The post on HAR file security explains why one should never be attached as it is. The request line and its status code are what a developer needs.
Notarus evidence capture attaches the screenshot, console errors and network calls to a bug report, records each call as its result without the request or response body, and strips passwords, tokens and cookies from captured logs. Session replay never records typed characters. So a report from a failing login page arrives with the status codes and the steps, and without the credentials that were typed into it.