Back to stories
<QA/>

Writing Good Test Cases: Criteria and Examples

Share by

Writing Good Test Cases: Criteria and Examples

Good test cases are clear, independent, and easy to maintain. This post gives practical criteria and short examples so you can write test cases that both humans and automation can use effectively.


Criteria for good test cases

  • Clear and specific: One scenario per test case; steps and expected results are unambiguous.
  • Independent: Can be run in any order; no hidden dependency on other tests.
  • Repeatable: Same steps and data produce the same result every time.
  • Traceable: Linked to requirements or user stories when applicable.
  • Maintainable: When the feature changes, you know which test cases to update.

Structure: steps and expected results

Each step should have a clear action and, where helpful, an expected result. Example:

  1. Open the login page. Expected: Login form is visible.
  2. Enter valid email and password. Expected: Fields accept input.
  3. Click "Sign in." Expected: User is redirected to dashboard.

One test case = one path (e.g. happy path, or one specific error case).


Positive, negative, and edge cases

  • Positive: Valid inputs and expected behavior (e.g. login with correct credentials).
  • Negative: Invalid inputs and error handling (e.g. wrong password, empty fields).
  • Edge: Boundaries (e.g. min/max length, first/last item in a list).

Design at least one test case per important positive, negative, and edge scenario.


Summary

  • Good test cases are clear, independent, repeatable, traceable, and maintainable.
  • Use consistent structure: steps + expected results; one scenario per case.
  • Cover positive, negative, and edge cases for critical behavior.