Blog
100+ Test Cases for Login Page

Rishabh Kumar
Published on

Table of contents
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Every app starts at the login page. It’s the first thing users see, the first security check your system runs, and the first place people decide whether they trust you. One login bug can expose user accounts, lock staff out of business systems or knock customer confidence overnight.
So testing a login page is about more than “enter username, enter password, click Sign in”. Good login test cases cover how it works, how secure it is, how it performs under load, how it looks across browsers, and whether everyone can use it.
Below, you’ll find 105 test cases for a login page, grouped by type, each with an ID you can copy straight into your test plan. There are also BDD examples, a test case template and the tools to use for each type of testing.

What Are Test Cases for a Login Page?
Test cases for a login page are step-by-step checks that prove the sign-in process works correctly, securely and reliably. Each one sets out what to do, what to enter and what should happen.
Login testing covers more than the form itself:
Functional testing checks the right people get in, and the wrong people don’t.
Security testing looks for weaknesses like SQL injection, session hijacking and brute-force attacks.
Performance testing checks login stays fast when lots of people sign in at once.
UI testing checks the page looks right on every browser and screen size.
For enterprise apps, like those built on SAP, Oracle, Salesforce or Microsoft Dynamics 365, login testing also covers single sign-on (SSO), SAML and OAuth2, multi-factor authentication (MFA) and role-based access.
Types of Login Page Test Cases
Type | What It Checks | Example | IDs |
|---|---|---|---|
Positive | Valid sign-ins work as expected | Valid details take the user to their dashboard | LP-001 to LP-015 |
Negative | Mistakes and bad input are handled safely | A wrong password shows a general error | LP-016 to LP-030 |
Security | The login can’t be easily attacked | The session token changes after login | LP-031 to LP-045 |
Enterprise and SSO | SSO, SAML, OAuth2 and roles work at scale | SAML login gives the user the right role | LP-046 to LP-060 |
Performance | Login stays fast under load | 1,000 people can sign in at once within your target time | LP-061 to LP-072 |
UI and visual | The page looks and behaves right everywhere | The page adapts properly on a phone | LP-073 to LP-085 |
API | The login endpoints behave correctly | Wrong details return HTTP 401 | LP-086 to LP-095 |
Accessibility | Everyone can sign in, including people using assistive technology | The whole login works with just a keyboard | LP-096 to LP-105 |
BDD | Login scenarios written in plain language for the whole team | “Given I’m on the login page…” | 4 example scenarios |
How to Write a Login Test Case
Each login test case should have the same parts, so anyone on the team can run it and get the same result.
100+ Test Cases for Login Page
Positive Login Test Cases
These check that the normal ways of signing in work properly.
Valid username and password
The user lands on the right page after login, a session is created, and their name or profile shows. Run this first, because nothing else matters if it fails.
Minimum allowed length for both fields
Login works with the shortest username and password allowed, which shows the minimum limit is included, not excluded.
Maximum allowed length for both fields
Login works at the longest length allowed, and nothing is cut off.
Remember Me after closing the browser
The user is still signed in after reopening the browser, and the saved session ends after the configured time.
Email address as the username
Login works when the app accepts email addresses as usernames.
Phone number as the username, where supported
Login works with a registered phone number, both with and without the country code.
MFA by SMS, authenticator app and security key
The second step appears after the password, and each supported method creates a full session.
Username in mixed case
User@Example.COM works if usernames aren’t case-sensitive, or fails with a clear error if they are. This catches apps that are inconsistent about case.
Special characters in the password
Passwords with characters like @ # $ % ^ & * ( ) work, and nothing is stripped or changed.
Social login
For each provider, like Google, Microsoft, Apple or GitHub, the redirect is right, a session is created, and profile details come across correctly.
Login after resetting a password
The new password works, and the old one is rejected.
Login after account recovery
Login works after email recovery, and the account has the right permissions and data.
Login on different browsers
Login works the same way on Chrome, Firefox, Safari and Edge. Any difference is a bug.
Login with a different language set
Labels, errors and messages appear in the right language, and login still works.
Passkeys and biometrics, on supported devices
Fingerprint, face or device PIN signs the user in without a password. The password fallback works, and a passkey can’t be used from a device it wasn’t registered on.
Negative Login Test Cases
These check the login page handles mistakes, missing details and unexpected input safely. This is where many of the costliest bugs hide.
Wrong password for a real username
The error is general, like “Invalid email or password”, and doesn’t say which field was wrong. Saying “wrong password” confirms the username exists.
Unknown username
The error is exactly the same as test case 16, so attackers can’t work out which usernames exist.
Empty username
A message appears on the username field, the form doesn’t submit, and no login request is sent.
Empty password
A message appears on the password field, and no login request is sent.
Both fields empty
Messages appear on both fields at the same time, not one after the other.
Username of only spaces
It’s rejected with a clear message, and no login request is sent.
Password of only spaces
It’s rejected with a clear message.
Deactivated or suspended account
With the correct password, the message says the account is inactive and how to get help. With a wrong password, the general error still shows, so the account status isn’t revealed to someone guessing.
Expired account
With the correct password, the message explains the account has expired and what to do next.
Too many failed attempts
The account locks at the set limit, and even the correct password is blocked while it’s locked.
Login while locked
The message says how long the lock lasts and how to unlock it, and the lock lasts the full time.
Spaces before or after the details
Copied details with extra spaces are either trimmed and accepted, or rejected with a clear message, consistently every time.
Markup characters in the username
Characters like < > " & are rejected or handled safely, and never shown back unescaped in an error.
Quotes, semicolons and double dashes
Login fails with the general error, and no database errors or technical details appear.
Very long input
10,000+ characters in either field is rejected with HTTP 400 or a validation message, not a timeout, crash or HTTP 500.
Security Test Cases for a Login Page
These check for the weaknesses attackers go after most often.
HTTPS only
Plain HTTP is redirected to HTTPS before any details are sent. The certificate is valid and in date, and the TLS version and ciphers are up to date.
Passwords never in plain text
Passwords never appear in network traffic, browser tools or logs, and are stored using a modern hashing method like bcrypt, scrypt or Argon2, not MD5 or SHA-1.
SQL injection
Injection attempts in either field fail, the app uses parameterised queries, and no database errors appear.
Cross-site scripting (XSS)
Script in either field is never shown back in errors, logs or anywhere else.
New session token after login
The session token before login is different from the one after. Reusing it allows session fixation attacks.
Secure cookie settings
The session cookie has Secure, HttpOnly and SameSite (Strict or Lax) set.
Brute-force protection
After the set number of failures, the app locks the account, limits attempts or shows a CAPTCHA.
No username guessing
Error messages, response times and status codes are the same for real and fake usernames.
Clickjacking protection
X-Frame-Options is DENY or SAMEORIGIN, or the Content Security Policy uses frame-ancestors, so the page can’t be loaded in someone else’s frame.
Password masking
The password is hidden as it’s typed, the “show password” toggle works both ways, and the password isn’t saved in autocomplete history.
Forgot password doesn’t reveal accounts
The reset message is the same for registered and unregistered emails.
Idle timeout
An unused session expires after the set time, and the user has to sign in again.
Signing in on a second device
The app follows its policy: it ends the first session, keeps both, or tells the user.
Password managers and pasting
The username field uses autocomplete="username", the password field uses autocomplete="current-password", password managers can fill both, and pasting isn’t blocked.
Failed attempts are logged
Each failed attempt is logged with the time, the username tried and the IP address.
Enterprise and SSO Login Test Cases
Enterprise apps add sign-in complexity most consumer apps never deal with.
SAML SSO redirect
Clicking SSO goes to the right identity provider, and the SAML request has the right issuer, return URL and name ID policy.
Successful SAML login
After signing in at the identity provider, the user returns to the app with a valid session and the right details from the SAML response.
Expired or tampered SAML response
Reusing an expired response, or one changed after signing, is rejected, and no session is created.
OAuth2 login
The authorisation code comes back to the right place, and is swapped for access and refresh tokens with the right scopes and expiry.
OAuth2 token refresh
When the access token expires, the refresh token gets a new one without asking the user to sign in again, and the old one stops working.
OpenID Connect profile details
The ID token has the right email, name and any custom claims, and they’re mapped to the user’s profile.
Multi-tenant routing
A user from one organisation lands in their own organisation’s space, never another one’s. This is one of the most serious login bugs in enterprise apps.
Role-based access
Admin, standard, read-only and other roles each get exactly their own permissions, and nothing more.
Microsoft Entra ID SSO on every browser
Entra ID (formerly Azure Active Directory) sign-in works on Chrome, Firefox, Safari and Edge. Third-party cookie rules can make browsers behave differently.
Okta session timeout
When the Okta session expires, the user is sent to Okta to sign in again, then back to where they were.
SCIM-provisioned accounts
A user created through SCIM can sign in straight away, with no manual steps.
Several identity providers
The same person signing in through different providers ends up with one profile, not duplicates.
Step-up verification
Sensitive actions, like changing account settings or approving a large payment, ask for an extra check before going ahead.
Accounts created on first SSO login
A user who exists in the identity provider but not the app gets an account with the right details and permissions on first sign-in.
Maximum session length
Sessions end after the organisation’s maximum time, even if the user is active.
Performance Test Cases for a Login Page
The targets below are common starting points. Adjust them to your own service levels and traffic.
Page load time
The login form is usable in under two seconds on desktop and mobile. Run it ten times and record the median, 95th percentile and maximum.
1,000 people signing in at once
All logins succeed within your target time. Record error rates, average time and 95th percentile time.
10,000 sign-ins at once
The system slows down gracefully, without crashing or returning HTTP 500. Note when errors start.
Login API speed under normal load
95% of requests finish within 200 milliseconds.
Login API speed at peak
Response times stay within your service level targets, and any slowdown is recorded.
Slow connections
Login still works acceptably on simulated 3G and 4G connections.
Server resources at peak
CPU, memory and bandwidth stay within limits, and don’t slow down the rest of the app.
Database connections
The database connection pool copes with the load without timeouts.
Login time with MFA
The full login, including the second step, finishes within your target, allowing for the user’s own time.
Caching and CDN
CSS, JavaScript and images come from a CDN with the right cache settings, and repeat visits load faster.
Time until the page is usable, on each browser
The form is usable within your target on Chrome, Firefox, Safari and Edge.
Recovery after a back-end failure
If the identity provider or database fails mid-login, the user sees a clear error rather than waiting forever, and login works again once it’s back.
UI and Visual Test Cases for a Login Page
Desktop layout
The page matches the approved design at 1280px, 1440px and 1920px wide.
Tablet layout
The layout works from 768px to 1024px, in portrait and landscape, with nothing cut off or overlapping.
Mobile layout
The page works from 320px to 480px, fields are easy to tap, and the button is reachable without scrolling sideways.
Username field focused on load
The cursor starts in the username field.
Tab order
Tab moves through username, password, Remember Me, Forgot Password, then Sign in.
Button disabled until both fields are filled, where used
The button is clearly disabled when either field is empty, and becomes active once both have input.
Errors next to the field
Errors appear under the field that caused them, not just as a banner at the top.
Placeholder text
Placeholders are helpful, disappear when typing starts, and come back if the field is cleared.
Show password toggle
The toggle shows and hides the password, its icon or label changes, and the password itself doesn’t change.
Light and dark mode
The page looks right and is readable in both modes.
Brand consistency
Logos, colours and fonts match the brand guidelines.
200% zoom
Everything is still visible and usable, with no overlapping and no sideways scrolling.
CAPTCHA, where used
The CAPTCHA displays and works on Chrome, Firefox, Safari and Edge.
API Login Test Cases
Testing the login API directly catches problems the screen can hide.
Valid details
The login endpoint returns HTTP 200 with a valid, correctly formatted token that hasn’t expired.
Wrong details
It returns HTTP 401 with a general error that doesn’t say which detail was wrong.
Missing fields
Leaving out the username or password returns HTTP 400, saying which field is missing.
Token expiry
The token’s expiry matches the configured lifetime.
Token contents
The token includes the user ID, role or scope, tenant where relevant, and any custom claims the app needs.
Expired token
Protected endpoints reject an expired token with HTTP 401 and return no data.
Rate limiting
Going over the limit returns HTTP 429, with a Retry-After header.
Refresh token
The refresh endpoint issues a new access token that works, and the old one behaves as documented.
Revoked token
A revoked token is rejected straight away, by every service that uses it.
Tampered token
A token with a changed claim, like the role, and no new signature is rejected with HTTP 401.
Here’s what LP-087 and LP-095 might look like as automated API tests:
JavaScript (Playwright API testing)
Accessibility Test Cases for a Login Page
Field labels
Every field has a label linked through for and id, aria-label or aria-labelledby, so screen readers announce it.
Colour contrast
Normal text has a contrast ratio of at least 4.5:1 and large text at least 3:1, including borders, placeholders and button text (WCAG 2.2 AA).
Keyboard only
The whole login, including the toggle, Remember Me and Sign in, works without a mouse.
Visible focus
Every element shows a clear focus indicator that doesn’t rely on colour alone.
Errors announced
Screen readers announce errors automatically, through ARIA live regions or by moving focus to the error.
Heading structure
There’s one H1, and no heading levels are skipped.
Accessible CAPTCHA
Any CAPTCHA has an accessible alternative, like audio or another way to verify.
Errors linked to fields
Each error is linked to its field with aria-describedby, so screen readers say which field it’s about.
No memory or puzzle tests (WCAG 2.2, 3.3.8 Accessible Authentication)
Users can sign in without memorising, retyping or solving anything. Password managers and pasting work, and any CAPTCHA has a non-puzzle alternative.
Focus not hidden (WCAG 2.2, 2.4.11 Focus Not Obscured)
With cookie banners and sticky headers showing, the focused field or button is never fully covered.
BDD Test Cases for a Login Page
Behaviour-driven development (BDD) scenarios are written in plain language, so QA, developers and business stakeholders can all read and agree on them.
Best Practices for Login Page Test Cases
Practice | Why It Matters |
|---|---|
Start with the highest risks | Test for stolen accounts, session hijacking and login bypass before cosmetic checks |
Use clear IDs and a consistent format | IDs, titles, preconditions, steps and expected results make tests easy to track and report on |
Keep positive and negative tests separate | Grouping by intent makes suites easier to find your way around and extend |
Test the API as well as the form | Testing only the screen misses back-end weaknesses |
Automate early | Login runs in every regression cycle, so automating it pays off on every release |
Test in every environment | Settings often differ between development, staging and production, which is a common cause of login bugs |
Tools for Login Page Testing
No single tool covers every type of login test. Here’s what’s typically used for each:
Type of Testing | Common Tools |
|---|---|
Functional and UI automation | Virtuoso QA, Selenium, Playwright, Cypress |
API testing | Virtuoso QA, Postman, REST Assured, Playwright’s API testing |
Security testing | OWASP ZAP, Burp Suite |
Performance and load testing | JMeter, k6, Gatling |
Accessibility testing | axe, Lighthouse, WAVE, plus manual checks with screen readers like NVDA and VoiceOver |
A few notes on the automation tools:
Selenium: the most widely used open-source browser automation framework. It gives you a lot of control, but needs coding skills and ongoing maintenance.
Cypress: a good fit for modern JavaScript apps, with automatic waiting and fast feedback. It supports Chrome-family browsers and Firefox, with WebKit support still experimental.
Playwright: runs across Chromium, Firefox and WebKit, and handles modern page features like Shadow DOM well.
Virtuoso QA: an AI testing platform where login tests are written in plain English and run across 2,000+ browser and OS combinations. For enterprise teams testing SSO and login on business systems like SAP, Oracle, Salesforce and Dynamics 365, it keeps tests working through UI changes and records exactly how login was tested on every release.
How AI is Transforming Login Page Testing
Traditional login testing depends on hand-written test cases, brittle selectors and constant upkeep.
AI-native testing changes each of those.
AI Powered Test Generation
Virtuoso QA's Touchstone agents draft login tests from your existing specs, user stories and security policies, citing the source for each one. A named person approves every requirement before it's built.
Self Healing Test Maintenance
When field IDs, button text or CSS classes change, self-healing finds the element through other signals and updates the test. Every repair is logged for your team to review, so nothing changes without a record.
Natural Language Test Authoring
With Natural Language Programming, manual testers and analysts can write login tests in plain English, including steps that handle iFrames, Shadow DOM and API calls.
Cross Browser Validation at Scale
Login tests run in parallel across 2,000+ browser, device and OS combinations, confirming authentication works the same everywhere.
Composable Test Libraries for Authentication
Reusable authentication modules are configured for each application instead of rebuilt for every project.
Evidence for Every Authentication Release
Every run produces release evidence showing which requirement each login test covers and who approved it. When a security review asks how authentication was tested, the answer is already written down.
Related Reads
Login Page Test Cases FAQs
How many test cases are needed for a login page?
What are the most important login page test cases?
How do you test SSO login functionality?
Can AI automate login page test creation?
How do you test login page performance?
What accessibility standards apply to login pages?
Written by

Rishabh Kumar
AI Testing & Quality Engineering Contributor
Rishabh leads business development and marketing at Virtuoso QA. He writes about AI-powered test automation, end-to-end testing, self-healing tests, and quality engineering, exploring how these capabilities can improve test coverage, reduce test maintenance, and support reliable software releases.









