Manual Testing · Test Design Techniques

Writing Good Test Cases

Lesson 7 of 12 · 10 min read

A test case is a set of steps, data and an expected result that checks one thing. Good test cases can be run by anyone on the team and give the same result.

Parts of a test case

  • ID and title: TC_LOGIN_003 – Login fails with a wrong password
  • Preconditions: a registered user exists; the user is logged out
  • Steps: numbered, one action per step
  • Test data: the exact values to use
  • Expected result: what should happen, specific and checkable
  • Priority: High, Medium or Low

Example

TitleLogin fails with a wrong password
PreconditionsUser ana@example.com exists with password Secret123
Steps1. Open the login page
2. Enter ana@example.com
3. Enter wrongPass1
4. Click Log in
ExpectedThe user stays on the login page and sees "Invalid email or password". The password field is cleared.

Tips

  • Test one thing per test case.
  • Write the expected result before you run the test.
  • Cover positive, negative and edge cases.
  • Avoid vague words like "works properly". Say exactly what should be seen.
Practice: write five test cases for the practice register page, then run them.
All 12 lessons in Manual Testing
  1. What Is Software Testing?
  2. QA vs QC vs Testing
  3. The Software Testing Life Cycle (STLC)
  4. Levels of Testing
  5. Functional vs Non-functional Testing
  6. Smoke, Sanity and Regression Testing
  7. Writing Good Test Cases
  8. Equivalence Partitioning and Boundary Value Analysis
  9. Decision Tables and State Transitions
  10. The Bug Life Cycle
  11. Writing a Great Bug Report
  12. Severity vs Priority, and Your Final Practice