Platform

Solutions

Resources

Platform

Solutions

Resources

Platform

Solutions

Resources

Blog

100+ Test Cases for Login Page

Rishabh Kumar

Published on

Login page test cases

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 Login Testing Covers



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.

  1. 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.

  1. Minimum allowed length for both fields

Login works with the shortest username and password allowed, which shows the minimum limit is included, not excluded.

  1. Maximum allowed length for both fields

Login works at the longest length allowed, and nothing is cut off.

  1. 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.

  1. Email address as the username

Login works when the app accepts email addresses as usernames.

  1. Phone number as the username, where supported

Login works with a registered phone number, both with and without the country code.

  1. MFA by SMS, authenticator app and security key

The second step appears after the password, and each supported method creates a full session.

  1. 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.

  1. Special characters in the password

Passwords with characters like @ # $ % ^ & * ( ) work, and nothing is stripped or changed.

  1. 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.

  1. Login after resetting a password

The new password works, and the old one is rejected.

  1. Login after account recovery

Login works after email recovery, and the account has the right permissions and data.

  1. Login on different browsers

Login works the same way on Chrome, Firefox, Safari and Edge. Any difference is a bug.

  1. Login with a different language set

Labels, errors and messages appear in the right language, and login still works.

  1. 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.

  1. 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.

  1. Unknown username

The error is exactly the same as test case 16, so attackers can’t work out which usernames exist.

  1. Empty username

A message appears on the username field, the form doesn’t submit, and no login request is sent.

  1. Empty password

A message appears on the password field, and no login request is sent.

  1. Both fields empty

Messages appear on both fields at the same time, not one after the other.

  1. Username of only spaces

It’s rejected with a clear message, and no login request is sent.

  1. Password of only spaces

It’s rejected with a clear message.

  1. 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.

  1. Expired account

With the correct password, the message explains the account has expired and what to do next.

  1. Too many failed attempts

The account locks at the set limit, and even the correct password is blocked while it’s locked.

  1. Login while locked

The message says how long the lock lasts and how to unlock it, and the lock lasts the full time.

  1. 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.

  1. Markup characters in the username

Characters like < > " & are rejected or handled safely, and never shown back unescaped in an error.

  1. Quotes, semicolons and double dashes

Login fails with the general error, and no database errors or technical details appear.

  1. 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.

  1. 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.

  1. 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.

  1. SQL injection

Injection attempts in either field fail, the app uses parameterised queries, and no database errors appear.

  1. Cross-site scripting (XSS)

Script in either field is never shown back in errors, logs or anywhere else.

  1. New session token after login

The session token before login is different from the one after. Reusing it allows session fixation attacks.

  1. Secure cookie settings

The session cookie has Secure, HttpOnly and SameSite (Strict or Lax) set.

  1. Brute-force protection

After the set number of failures, the app locks the account, limits attempts or shows a CAPTCHA.

  1. No username guessing

Error messages, response times and status codes are the same for real and fake usernames.

  1. 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.

  1. 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.

  1. Forgot password doesn’t reveal accounts

The reset message is the same for registered and unregistered emails.

  1. Idle timeout

An unused session expires after the set time, and the user has to sign in again.

  1. Signing in on a second device

The app follows its policy: it ends the first session, keeps both, or tells the user.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. Expired or tampered SAML response

Reusing an expired response, or one changed after signing, is rejected, and no session is created.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. Role-based access

Admin, standard, read-only and other roles each get exactly their own permissions, and nothing more.

  1. 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.

  1. Okta session timeout

When the Okta session expires, the user is sent to Okta to sign in again, then back to where they were.

  1. SCIM-provisioned accounts

A user created through SCIM can sign in straight away, with no manual steps.

  1. Several identity providers

The same person signing in through different providers ends up with one profile, not duplicates.

  1. Step-up verification

Sensitive actions, like changing account settings or approving a large payment, ask for an extra check before going ahead.

  1. 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.

  1. 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.

  1. 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. 1,000 people signing in at once

All logins succeed within your target time. Record error rates, average time and 95th percentile time.

  1. 10,000 sign-ins at once

The system slows down gracefully, without crashing or returning HTTP 500. Note when errors start.

  1. Login API speed under normal load

95% of requests finish within 200 milliseconds.

  1. Login API speed at peak

Response times stay within your service level targets, and any slowdown is recorded.

  1. Slow connections

Login still works acceptably on simulated 3G and 4G connections.

  1. Server resources at peak

CPU, memory and bandwidth stay within limits, and don’t slow down the rest of the app.

  1. Database connections

The database connection pool copes with the load without timeouts.

  1. Login time with MFA

The full login, including the second step, finishes within your target, allowing for the user’s own time.

  1. Caching and CDN

CSS, JavaScript and images come from a CDN with the right cache settings, and repeat visits load faster.

  1. Time until the page is usable, on each browser

The form is usable within your target on Chrome, Firefox, Safari and Edge.

  1. 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

  1. Desktop layout

The page matches the approved design at 1280px, 1440px and 1920px wide.

  1. Tablet layout

The layout works from 768px to 1024px, in portrait and landscape, with nothing cut off or overlapping.

  1. Mobile layout

The page works from 320px to 480px, fields are easy to tap, and the button is reachable without scrolling sideways.

  1. Username field focused on load

The cursor starts in the username field.

  1. Tab order

Tab moves through username, password, Remember Me, Forgot Password, then Sign in.

  1. 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.

  1. Errors next to the field

Errors appear under the field that caused them, not just as a banner at the top.

  1. Placeholder text

Placeholders are helpful, disappear when typing starts, and come back if the field is cleared.

  1. Show password toggle

The toggle shows and hides the password, its icon or label changes, and the password itself doesn’t change.

  1. Light and dark mode

The page looks right and is readable in both modes.

  1. Brand consistency

Logos, colours and fonts match the brand guidelines.

  1. 200% zoom

Everything is still visible and usable, with no overlapping and no sideways scrolling.

  1. 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.

  1. Valid details

The login endpoint returns HTTP 200 with a valid, correctly formatted token that hasn’t expired.

  1. Wrong details

It returns HTTP 401 with a general error that doesn’t say which detail was wrong.

  1. Missing fields

Leaving out the username or password returns HTTP 400, saying which field is missing.

  1. Token expiry

The token’s expiry matches the configured lifetime.

  1. Token contents

The token includes the user ID, role or scope, tenant where relevant, and any custom claims the app needs.

  1. Expired token

Protected endpoints reject an expired token with HTTP 401 and return no data.

  1. Rate limiting

Going over the limit returns HTTP 429, with a Retry-After header.

  1. Refresh token

The refresh endpoint issues a new access token that works, and the old one behaves as documented.

  1. Revoked token

A revoked token is rejected straight away, by every service that uses it.

  1. 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)

test('LP-087: wrong password returns a general 401 error', async ({ request }) => {
  const response = await request.post('/api/auth/login', {
    data: { username: 'jane@example.com', password: 'wrong-password' }
  });
  expect(response.status()).toBe(401);
  const body = await response.json();
  expect(body.message).toBe('Invalid email or password');
});

test('LP-095: tampered token is rejected', async ({ request }) => {
  const tamperedToken = changeRoleClaimWithoutResigning(validToken, 'admin');
  const response = await request.get('/api/admin/users', {
    headers: { Authorization: `Bearer ${tamperedToken}` }
  });
  expect(response.status()).toBe(401);
});
test('LP-087: wrong password returns a general 401 error', async ({ request }) => {
  const response = await request.post('/api/auth/login', {
    data: { username: 'jane@example.com', password: 'wrong-password' }
  });
  expect(response.status()).toBe(401);
  const body = await response.json();
  expect(body.message).toBe('Invalid email or password');
});

test('LP-095: tampered token is rejected', async ({ request }) => {
  const tamperedToken = changeRoleClaimWithoutResigning(validToken, 'admin');
  const response = await request.get('/api/admin/users', {
    headers: { Authorization: `Bearer ${tamperedToken}` }
  });
  expect(response.status()).toBe(401);
});
test('LP-087: wrong password returns a general 401 error', async ({ request }) => {
  const response = await request.post('/api/auth/login', {
    data: { username: 'jane@example.com', password: 'wrong-password' }
  });
  expect(response.status()).toBe(401);
  const body = await response.json();
  expect(body.message).toBe('Invalid email or password');
});

test('LP-095: tampered token is rejected', async ({ request }) => {
  const tamperedToken = changeRoleClaimWithoutResigning(validToken, 'admin');
  const response = await request.get('/api/admin/users', {
    headers: { Authorization: `Bearer ${tamperedToken}` }
  });
  expect(response.status()).toBe(401);
});
test('LP-087: wrong password returns a general 401 error', async ({ request }) => {
  const response = await request.post('/api/auth/login', {
    data: { username: 'jane@example.com', password: 'wrong-password' }
  });
  expect(response.status()).toBe(401);
  const body = await response.json();
  expect(body.message).toBe('Invalid email or password');
});

test('LP-095: tampered token is rejected', async ({ request }) => {
  const tamperedToken = changeRoleClaimWithoutResigning(validToken, 'admin');
  const response = await request.get('/api/admin/users', {
    headers: { Authorization: `Bearer ${tamperedToken}` }
  });
  expect(response.status()).toBe(401);
});


Accessibility Test Cases for a Login Page

  1. Field labels

Every field has a label linked through for and id, aria-label or aria-labelledby, so screen readers announce it.

  1. 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).

  1. Keyboard only

The whole login, including the toggle, Remember Me and Sign in, works without a mouse.

  1. Visible focus

Every element shows a clear focus indicator that doesn’t rely on colour alone.

  1. Errors announced

Screen readers announce errors automatically, through ARIA live regions or by moving focus to the error.

  1. Heading structure

There’s one H1, and no heading levels are skipped.

  1. Accessible CAPTCHA

Any CAPTCHA has an accessible alternative, like audio or another way to verify.

  1. Errors linked to fields

Each error is linked to its field with aria-describedby, so screen readers say which field it’s about.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. Cross Browser Validation at Scale

Login tests run in parallel across 2,000+ browser, device and OS combinations, confirming authentication works the same everywhere.

  1. Composable Test Libraries for Authentication

Reusable authentication modules are configured for each application instead of rebuilt for every project.

  1. 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.

See what your next release looks like with Virtuoso

Book a walkthrough on your applications and your workflows. Bring a requirement, a user journey, or a brittle Selenium script, and watch the loop run on something you recognise.

See what your next release looks like with Virtuoso

Book a walkthrough on your applications and your workflows. Bring a requirement, a user journey, or a brittle Selenium script, and watch the loop run on something you recognise.

See what your next release looks like with Virtuoso

Book a walkthrough on your applications and your workflows. Bring a requirement, a user journey, or a brittle Selenium script, and watch the loop run on something you recognise.

Virtuoso QA is establishing the standard of proof for software releases. Its governed QA loop turns business requirements into tests for any browser-based application: AI proposes, a deterministic engine executes, a person approves what matters, and every decision leaves evidence.

Trust Center

AICPA

SOC

WAVE STRONG PERFORMER

@ Copyright 2026 SpotQA, Creators of Virtuoso QA

Virtuoso QA is establishing the standard of proof for software releases. Its governed QA loop turns business requirements into tests for any browser-based application: AI proposes, a deterministic engine executes, a person approves what matters, and every decision leaves evidence.

Trust Center

AICPA

SOC

WAVE STRONG PERFORMER

@ Copyright 2026 SpotQA, Creators of Virtuoso QA

Virtuoso QA is establishing the standard of proof for software releases. Its governed QA loop turns business requirements into tests for any browser-based application: AI proposes, a deterministic engine executes, a person approves what matters, and every decision leaves evidence.

Trust Center

AICPA

SOC

WAVE STRONG PERFORMER

@ Copyright 2026 SpotQA, Creators of Virtuoso QA