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