How to Write Test Cases
Harry
· 21 Sep 2026
· 2 views
Log in to track your progress and mark lessons complete.
What is a Test Case?
A test case is a documented set of steps, data and expected results used to verify one behaviour. Test Scenario is the what (verify login); Test Case is the how (steps with data).
Test Case Template
ID: TC_LOGIN_001
Title: Valid user can log in
Preconditions: user registered, on /login
Steps: 1. Enter email 2. Enter password 3. Click Login
Data: user@test.com / Pass@123
Expected: redirect to /dashboard, welcome banner shown
Severity: Critical | Priority: HighGood Test Case Habits
- One behaviour per case, independent and repeatable.
- Use real representative data, plus one negative case per field.
- Name expected results exactly (text, URL, status code).
- Keep steps atomic so anyone can execute them.
Test Data
Prepare valid, invalid, boundary and empty data sets. Mask PII; refresh data between runs so tests never depend on execution order.
- Scenario groups cases; cases prove behaviour.
- A case without expected results is just exploration notes.
- Negative cases find more bugs than happy paths.