Skip to main content

Test Case

A test case is a documented set of preconditions, steps, test data, and an expected result used to verify one specific piece of application behavior. It's the smallest unit of testing you actually execute and mark pass or fail — the building block that test suites, test plans, and traceability matrices are all made of.

A well-written test case doesn't assume anything the reader hasn't been told. It states the preconditions (what state the system needs to be in before you start), the exact steps to execute in order, the test data to use, and — critically — the expected result stated specifically enough that pass/fail isn't a judgment call.

Test cases sit one level below test scenarios. A scenario like "verify login works" might expand into a dozen test cases: valid credentials, wrong password, locked account, expired session, SSO redirect, and so on. Each of those is independently executable and independently reportable.

In manual testing, a test case usually lives in a test case management tool (TestRail, Zephyr, Xray) as a structured record. In automated testing, the "test case" is a function or block of code — but the same discipline applies: one clear assertion of intent, one clear expected outcome, no hidden dependencies on execution order.

The biggest failure mode isn't writing too few test cases — it's writing vague ones. "Test that login works" isn't a test case. "Enter a valid username and password, click Sign In, and confirm the user lands on /dashboard within 3 seconds" is.

Example

Precondition: User has a registered, unlocked account.
Steps: 1) Go to /login  2) Enter valid email + password  3) Click "Sign In"
Expected result: User is redirected to /dashboard within 3 seconds and sees their name in the header.

A minimal but unambiguous test case for a login flow.