Example test cases for a login page

Below is an example of preparing various test cases for a login page with a username and password.

Unit Test case: Here we are only checking if the username validates at least for the length of eight characters.

Test Id Test Condition Test Steps Test Input       Test Expected Result Actual Result Status     Remarks      
1. Check if the username field accepts the input of thirteen characters. 1. Give input   w3wiki            Accepts for thirteen characters. Accepts for thirteen characters. Pass  None 

Here it is only checked whether the passing of input of thirteen characters is valid or not. So since the character word ‘w3wiki’ is entered then the test is successful it would have failed for any other test case.  

 Functionality Test case: Here it is checked whether the username and password both work together on the login click.

Test Id Test Condition Test Steps                                     Test Input                                                   Test Expected Result Actual Result Status       Remarks         
1. Check that with the correct username and password able to log in.

1. Enter the username 

2. Enter the password

3. Click on the login 

username: geeks for geeks

password: geeksforever                  

Login successful Login successful Pass None
2. Check that if with an incorrect username and password able to not login.

1. Enter the username

2. Enter the password

3. Click on the login 

username: w3wiki

password: geekstogether   

Login unsuccessful Login unsuccessful    Pass None

Here it is being checked whether passing wrong and right inputs and if the login functionality is working or not, it’s showing login is successful for the right credentials and unsuccessful for the wrong ones, hence both tests have passed otherwise would have failed.

User Acceptance Test Case: Here the user feedback is taken if the login page is loading properly or not.

Test Id                                   Test Condition Test Steps                                     Test Input                                                   Test Expected Result Actual Result Status           Remarks       
1. Check if the loading page loading efficiently for the client.   1. Click on the login button.  None Welcome to the login page. Welcome to the login page. Fail The login page is not loaded due to a browser compatibility issue on the user’s side. 

Here it is being checked in by clicking on the login button if the page is loaded and the ‘Welcome to login page’ message is displayed. The test has failed here as the page was not loaded due to a browser compatibility issue, it would have loaded if the test had passed. 



How to write Test Cases – Software Testing

Software testing is known as a process for validating and verifying the working of a software/application. It makes sure that the software is working without any errors, bugs, or any other issues and gives the expected output to the user. The software testing process isn’t limited to finding faults in the present software but also finding measures to upgrade the software in various factors such as efficiency, usability, and accuracy. So, to test software the software testing provides a particular format called a Test Case

This article focuses on discussing the following topics in the Test Case:

Table of Content

  • What is a Test Case?
  • Test Case vs Test Scenario
  • When do we Write Test Cases? 
  • Why Write Test Cases?   
  • Test Case Template
  • Best Practice for Writing Test Case
  • Test Case Management Tools
  • Types of Test Cases
  • Example test cases for a login page

Similar Reads

What is a Test Case?

A test case is a defined format for software testing required to check if a particular application/software is working or not. A test case consists of a certain set of conditions that need to be checked to test an application or software i.e. in more simple terms when conditions are checked it checks if the resultant output meets with the expected output or not. A test case consists of various parameters such as ID, condition, steps, input, expected result, result, status, and remarks....

Test Case vs Test Scenario

Below are some of the points of difference between a test case and a test scenario:...

When do we Write Test Cases?

Test cases are written in different situations:...

Why Write Test Cases?

Test cases are one of the most important aspects of software engineering, as they define how the testing would be carried out. Test cases are carried out for a very simple reason, to check if the software works or not. There are many advantages of writing test cases:...

Test Case Template

Let’s look at a basic test case template for the login functionality....

Best Practice for Writing Test Case

There are certain practices that one could follow while writing the test cases that would be considered beneficial....

Test Case Management Tools

Test management tools help to manage the test cases. These tools are automated tools that decrease the time and effort of a tester as compared to the traditional way. Some test case management tools include advanced dashboards, easier bug, and progress tracking as well as management, custom test case templates, integration of test cases, inviting guest testers, managing team requirements and plans, and much more....

Types of Test Cases

Functionality Test Case: The functionality test case is to determine if the interface of the software works smoothly with the rest of the system and its users or not. Black box testing is used while checking for this test case, as we check everything externally and not internally for this test case.  Unit Test Case: In unit test case is where the individual part or a single unit of the software is tested. Here each unit/ individual part is tested, and we create a different test case for each unit.   User Interface Test Case: The UI test or user interface test is when every component of the UI that the user would come in contact with is tested. It is to test if the UI components requirement made by the user are fulfilled or not.   Integration Test Case: Integration testing is when all the units of the software are combined and then they are tested. It is to check that each component and its units work together without any issues.  Performance Test Case: The performance test case helps to determine response time as well as the overall effectiveness of the system/software. It’s to see if the application will handle real-world expectations.  Database Test Case: Also known as back-end testing or data testing checks that everything works fine concerning the database. Testing cases for tables, schema, triggers, etc. are done.  Security Test Case: The security test case helps to determine that the application restricts actions as well as permissions wherever necessary. Encryption and authentication are considered as main objectives of the security test case. The security test case is done to protect and safeguard the data of the software.  Usability Test Case: Also known as a user experience test case, it checks how user-friendly or easy to approach a software would be. Usability test cases are designed by the User experience team and performed by the testing team.  User Acceptance Test Case: The user acceptance case is prepared by the testing team but the user/client does the testing and review if they work in the real-world environment....

Example test cases for a login page

Below is an example of preparing various test cases for a login page with a username and password....