Negative test cases for Login Page.
Negative Test Cases for Login Page
Some of the negative test cases for the Login page are as follows:
| Test Case ID | Test Scenario | Test Data | Steps | Expected Result |
|---|---|---|---|---|
| TC_001 | Login with both fields empty | Username: “” Password: “” |
|
Validation message displayed for required fields |
| TC_002 | Login with empty Username | Username: “” Password: ValidPassword123 |
|
Error message for missing Username |
| TC_003 | Login with empty Password | Username: validUser Password: “” |
|
Error message for missing Password |
| TC_004 | Login with invalid Username | Username: invalidUser Password: ValidPassword123 |
|
Error message: Invalid username or password |
| TC_005 | Login with invalid Password | Username: validUser Password: WrongPassword |
|
Error message: Invalid username or password |
| TC_006 | Password below minimum length | Username: validUser Password: 123 |
|
Validation message for password length requirement |
| TC_007 | Username exceeds maximum length | Username: 256+ characters Password: ValidPassword123 |
|
Error message for exceeding maximum length |
| TC_008 | Login with special characters in Username | Username: @@@###$$$ Password: ValidPassword123 |
|
Validation error for invalid username format |
| TC_009 | Login with SQL Injection attempt | Username: ‘ OR ‘1’=’1 Password: ‘ OR ‘1’=’1 |
|
Login should fail and input should be sanitized |
| TC_010 | Login with XSS script | Username: <script>alert(1)</script> Password: password |
|
Script should not execute; input should be sanitized |
| TC_011 | Account locked user login | Username: lockedUser Password: ValidPassword123 |
|
Error message indicating account is locked |
| TC_012 | Login with expired password | Username: validUser Password: ExpiredPassword |
|
Prompt to reset or change password |
| TC_013 | Multiple failed login attempts | Username: validUser Password: WrongPassword |
|
Account should be temporarily locked after threshold attempts |
| TC_014 | Login with leading/trailing spaces | Username: ” validUser ” Password: ” ValidPassword123 “ |
|
System trims spaces or shows appropriate validation error |
| TC_015 | Login when server is down | Valid credentials |
|
User-friendly error message displayed |