In this post, I’ll guide you step-by-step on how to write clear, reusable, and practical test cases, along with real-time examples and templates.
๐ What Is a Test Case?
A test case is a set of actions executed to verify a particular feature or functionality of your software application. Each test case includes test steps, expected results, inputs, and actual results.
๐ฏ Why Are Effective Test Cases Important?
- ✅ Ensure coverage of all scenarios
- ✅ Help developers understand the issue clearly
- ✅ Speed up test execution and defect tracking
- ✅ Make regression testing easier
- ✅ Useful for training and future references
๐งฉ Components of a Good Test Case
Field | Description |
---|---|
Test Case ID | Unique identifier (e.g., TC_UI_001) |
Test Case Title | Short, meaningful description |
Pre-Conditions | Conditions that must be met before execution |
Test Steps | Clear steps to perform the test |
Test Data | Input data needed for the test |
Expected Result | What should happen after execution |
Actual Result | What actually happened |
Status | Pass / Fail / In Progress |
Remarks | Notes, screenshots, or references |
๐ Real-Time Example: Login Functionality
Requirement: The User should be able to log in using a valid email and password. If credentials are invalid, show an error message.
✅ Test Case 1: Valid Login
- Test Case ID: TC_LOGIN_001
- Title: Login with valid credentials
- Pre-Condition: User already has a registered account
- Test Steps:
1. Go to the Login page
2. Enter a valid email
3. Enter a valid password
4. Click Login - Test Data: Email: user@example.com | Password: 123456
- Expected Result: User should be redirected to the Dashboard
- Actual Result: (To be filled after testing)
- Status: Pass/Fail
- Remarks: Screenshot attached if it failed
❌ Test Case 2: Invalid Password
- Test Case ID: TC_LOGIN_002
- Title: Login with invalid password
- Pre-Condition: User already has a registered account
- Test Steps:
1. Go to the Login page
2. Enter a valid email
3. Enter the wrong password
4. Click Login - Test Data: Email: user@example.com | Password: wrong123
- Expected Result: Error message: "Invalid credentials"
- Actual Result: (To be filled after testing)
- Status: Pass/Fail
๐ซ Test Case 3: Blank Fields
- Test Case ID: TC_LOGIN_003
- Title: Login with blank email and password
- Pre-Condition: None
- Test Steps:
1. Go to the Login page
2. Leave email & password blank
3. Click Login - Expected Result: Validation error messages displayed
- Actual Result: (To be filled after testing)
- Status: Pass/Fail
✅ Tips for Writing Better Test Cases
- ✅ Keep test case steps simple and clear
- ✅ Use consistent naming conventions
- ✅ Focus on one functionality per test case
- ✅ Include positive & negative test scenarios
- ✅ Update your test cases regularly
- ✅ Add screenshots or references if needed
- ✅ Avoid repetition – use shared preconditions
๐งช Additional Scenarios to Cover (Same Login Module)
- Log in with an unregistered email
- Log in with SQL injection attempt
- The login button is disabled without input
- Login page responsiveness on mobile
- Session timeout after login
๐ Hi, I'm Suriya — QA Engineer with 4+ years of experience in manual, API & automation testing.
๐ฌ Contact Me | LinkedIn | GitHub
๐ Follow for: Real-Time Test Cases, Bug Reports, Selenium Frameworks.
No comments:
Post a Comment