Q14 of 38 · Manual & exploratory
Walk me through how you would write test cases for a login form.
Short answer
Short answer: Start with the spec, partition inputs (valid/invalid email, valid/invalid password), apply BVA on length boundaries, then layer in non-functional cases — security, accessibility, error messaging, rate limiting. About 25–40 cases is realistic.
Detail
A login form looks trivial but covers a surprising amount of test design ground. My approach is to think out loud across categories rather than enumerate randomly.
Functional positive: valid credentials → success; correct redirect; session established.
Functional negative: wrong password, unknown user, empty fields, fields with leading/trailing whitespace.
EP + BVA on email: minimum length, maximum length, exactly-at-boundary, malformed (no @, multiple @, unicode local part).
EP + BVA on password: minimum length, maximum length, special characters, leading/trailing whitespace if allowed.
Security: SQL injection, XSS in email field, brute-force attempts, no information leakage on error messages ("invalid email or password" not "user not found"), HTTPS-only POST.
Rate limiting: N consecutive failures triggers lockout / captcha; lockout duration; reset behaviour.
Session: login persists across reload; logout invalidates session; concurrent sessions across devices behave per spec.
Accessibility: tab order, screen-reader error announcement (aria-live), labels associated with inputs, keyboard-only login.
Internationalisation: error messages localised; non-ASCII emails work; RTL languages render correctly.
Browser/device: works on supported browsers; mobile keyboards behave (no auto-capitalise on email).
Edge: copy-paste, autofill, password manager fills, "remember me" persistence.
I'd also flag what I'd want answered before testing: lockout policy, password complexity, MFA, OAuth/SSO. The biggest junior mistake is testing only happy path + "wrong password" and stopping.
// EXAMPLE
login-test-cases.md
### High-priority cases
TC1 Valid login with correct credentials → redirect to dashboard
TC2 Wrong password shows generic error, no info leak
TC3 Unknown email shows the same generic error (no enumeration)
TC4 Empty email submits → inline validation, no API call
TC5 6 failed attempts within 5 min triggers lockout per spec
TC6 Email with leading/trailing whitespace is trimmed (or rejected)
TC7 Password field never visible in DOM as plain text
TC8 Tab order: email → password → submit → forgot password
TC9 Submitting via Enter key works
TC10 Login persists across page reload
TC11 SQL injection in email rejected, no 500 error
TC12 Screen reader announces error message (aria-live=polite)
TC13 Login page enforces HTTPS; HTTP request is redirected
TC14 Lockout duration matches spec; clears after policy-defined time
TC15 Concurrent login on two devices behaves per spec// MODEL ANSWER
// WHAT INTERVIEWERS LOOK FOR
// COMMON PITFALL
// Related questions