How would you test a login form?
A login form is tested by risk: first questions about the password and lockout policy, then checks in priority order. Most important are a successful sign-in, the same response for an unknown email and a wrong password (so accounts are not revealed), protection against guessing and the session after logout. Data, UI and accessibility come next, and deep security testing is handled separately.
QA Fundamentals · Situational questions
A sign-in form with two fields. How many checks can you think of in a minute and in what order will you run them?
"How would you test a login form?" is a question about how you think, not about the length of the list. The interviewer watches whether there is structure, whether you start with questions ("what are the password rules? is there lockout?"), and whether you see not only data entry but also security, session state and errors. This lesson shows a way to split any simple form into groups and set priorities by risk.
How it works and why. A sign-in form looks simple, but behind it stand input data, account state, the session and protection against abuse. So it helps to split the checks by what can go wrong. Data: empty fields, spaces, case, length, special characters (equivalence classes and boundaries work here). Credentials: a correct pair, a wrong password, a non-existent email. Account state: blocked, unconfirmed, with an expired password. Protection: lockout or delay after attempts, the same response for "no such email" and "wrong password". Session: after logout, "Back", several tabs, expiry. Interface: Enter, autofill, keyboard, errors near the fields.
Priority is set by risk: a sign-in failure blocks everything, and abuse (guessing passwords, finding out which emails are registered) hits users' security. So the first checks are: successful sign-in, a wrong password with an identical response, protection against guessing, the session after logout. Cosmetics such as the alignment of a hint go last.
The identical response matters for a simple reason: if for a non-existent email the system says "user not found" and for a wrong password "wrong password", an attacker checks lists of addresses and learns who is registered (user enumeration). Not only the text can differ, but also the response time or the status code.
The message for wrong sign-in data
"User not found"
A different message for a wrong password: the response lets you check whether the email exists in the system.
"Invalid login or password"
The same text, code and roughly the same response time in both cases.
Example: from a list to a prioritised set. The weak answer: "I will check valid data, invalid data, empty fields and security". The strong one starts with assumptions and goes by risk (P1 is the most important):
Assumptions: email is case-insensitive, password is
case-sensitive; after 5 wrong attempts a temporary lockout.
P1 a correct pair → dashboard; session cookie HttpOnly, Secure
P1 a correct email, wrong password → "Invalid login or
password"
P1 a non-existent email → the same message and the same code
P1 5 wrong attempts, then the right password → lockout
P2 USER@Example.com instead of user@example.com → sign-in works
P2 the password in another case → rejected
P2 an empty field or only spaces → a hint, no request is sent
P2 logout, then "Back" → the sign-in page, not the dashboard
P3 Enter, autofill, Tab order, screen reader
You can see that each line has data and an expectation, and the first four are what is most expensive to miss. The assumptions come before the list: without them the expectations in lines 4-6 cannot be written, and they are confirmed with the PM.
Limits and alternatives. Locking an account after N attempts has a downside: an attacker can deliberately lock other people's accounts. So many systems use growing delays, CAPTCHA or IP limits instead of hard lockout, and QA asks which policy is adopted instead of assuming lockout is required. Checking combinations (browsers, devices) is needed, but its priority is below security. Stable P1 and P2 scenarios are worth automating through API and UI, while deeper security checks (guessing, injections) are usually part of separate security testing.
Common mistakes
- Starting with a list and no questions: without the password and lockout policy half of the expectations are made up.
- Checking only data entry: security, session and account state stay out of view, though the costlier defects are there.
- Considering different messages for email and password "more convenient": they are, but they reveal registered addresses.
- Forgetting "Back" after logout and session expiry: a protected page stays reachable from the cache.
- Testing with colleagues' real passwords: test accounts exist for this.
Check yourself
The sign-in form shows "Account blocked" for a blocked user and "Invalid login or password" for a wrong password. Is this a defect?
Answer
It depends on the requirement. If the blocked message is shown only after the correct password, it is acceptable: the owner sees it. If it appears without the correct password too, it reveals that the account exists and is blocked. So you first find out the policy and then phrase it: "defect" or "question".
Why does "5 wrong attempts, then the right password" expect a rejection and not a sign-in?
Answer
Because the point of lockout is to make guessing useless: if the right password after a series of wrong ones passes, an attacker simply continues until they guess. The check shows the protection holds even when the data is right, until the lockout time passes.