Test Cases for Login Page

Test Cases for Login Page

In this post, we will study – how to write test cases for a Login page. You can refer to these test cases while creating test cases for login page of your application under test.

As we know that the focus here is to cover the different features to be tested instead of the creation of formal test cases, so basically we will be presenting test scenarios here. If you want to know the exact difference between test cases and test scenarios, please refer to this post – Difference b/w Test Case and Test Scenario.

Let’s start with sample test cases of the login page now, categorized on the basis of different types of testing.

Test Cases for Login Page | How to write Test Cases for Login functionality? ArtOfTesting

UI Test Scenarios for Login Page

  1. Verify that all the labels and controls including text boxes, buttons, and links are present on the Login page.
  2. Check that the font type and size of the labels and the text written on the different elements should be clearly visible.
  3. Verify that the size, color, and UI of the different elements are as per the specifications.
  4. Verify that the application’s UI is responsive i.e. it should adjust to different screen resolutions and devices.

Functional Test Scenarios for Login Page

  1. Verify that as soon as the login page opens, by default the cursor should remain on the username textbox.
  2. Verify that the user is able to navigate or access the different controls by pressing the ‘Tab’ key on the keyboard.
  3. Check if the password is in masked form when typed in the password field.
  4. Check if the password can be copy-pasted or not.
  5. Verify that the user is able to login by entering valid credentials and clicking on the ‘Login’ button.
  6. Verify that the user is able to login by entering valid credentials and pressing Enter key.
  7. Check that the user is not able to login with an invalid username and password.
  8. Verify that the validation message gets displayed in case the user leaves the username or password field blank.
  9. Check that the validation message is displayed in case the user exceeds the character limit of the user name and password fields.
  10. Verify that the reset button functionality is on the login page. Clicking on it should clear the textbox’s content.
  11. Verify if there is a checkbox with the label “remember password” on the login page.
  12. Verify that closing the browser should not log out an authenticated user. Launching the application should lead the user to the login state only.

Security Test Cases for Login Page

  1. Verify that there is a limit on the total number of unsuccessful login attempts. So that a user cannot use a brute-force mechanism to try all possible combinations of username-password.
  2. Verify that in case of incorrect credentials, a message like “incorrect username or password” should get displayed. Instead of an exact message pointing to the incorrect field. This is because a message like “incorrect password” will help a hacker in knowing that the username is correct. In this way, he will just need to try a different combination on the password field only.
  3. Verify the login session timeout duration. So, once logged in a user cannot be authenticated for a lifetime.
  4. Verify that once logged in, clicking the back button doesn’t log out the user.
  5. Verify if SQL Injection attacks work on the login page. The application should not be vulnerable to SQL injection attacks.
  6. Verify that the XSS vulnerability should not work on the login page.


This concludes our post on the test cases for the login functionality. I hope these sample test cases will help you in your interviews. In addition, these should help you in writing test cases of similar forms. Please let us know in the comments, how we did. Also, let us know in case we have missed out on anything.

Test Case Examples

Login Page Registration Page E-commerce App Google Search
GMail Youtube Facebook ATM Machine
Chair Coffee Machine DateField Door
Calculator Fan Flight Reservation Car
Hospital Management Keyboard Kindle Lift
Mobile Phone Mouse Microwave Oven Notepad
Online Examination Pen Pencil Remote Control
Stapler Table Triangle TV
Wrist Watch Water Bottle Whatsapp White Board
Bike Marker Forgot Password Air Conditioner

Do check our detailed guide on Test Scenarios to learn about test scenarios along with its template.

От QA genius