DEV Community

Cover image for Test Case
Harini
Harini

Posted on

Test Case

What is a Test Case?

A test case is a set of conditions, inputs, and actions used to validate whether a specific feature of an application works correctly.

  • It defines what to test, how to test, and expected results
  • It acts as a blueprint for testing
  • It helps ensure the system works in normal, error, and edge conditions

Components of a Test Case

A standard test case includes:

  • Test Case ID
  • Test Scenario / Name
  • Preconditions
  • Test Steps
  • Test Data
  • Expected Result
  • Actual Result
  • Status (Pass/Fail)

What is a Test Scenario?
A test scenario is a high-level idea of what you want to test in a product or application.

Test Case vs Test Scenario

Test Scenario β†’ What to test (high-level)
Test Case β†’ How to test (detailed steps)

How to Write Test Cases

  1. Understand requirements
  2. Identify test scenarios
  3. Write clear test case name
  4. Define preconditions
  5. Write step-by-step actions
  6. Add test data
  7. Define expected result
  8. Execute and record actual result

Example: Invalid Password

Test Case Table

Top comments (0)