# Test Case

> One check in a test. It has a set input and a result you expect.

**Field:** Software Development  
**Category:** Testing & Quality  
**Also known as:** Test, Test Scenario

## Think of it like

Think of it like one question on a quiz. It has one right answer.

## Definition

A test case is one check: a set input, the steps to run and the result you expect. Adding 2 and 3 should give 5 is a test case. Each one is named for the thing it checks, so a failure tells you what broke. A good test case checks one thing, so it fails for one reason. Many test cases together make a test suite.

## Example

Jack writes three test cases for his login. One has the right password, one the wrong one, and one an empty box.

## Example code

```python
def test_total():
    assert total([2, 3]) == 5
```

One test case: the total of 2 and 3 should be 5.

## Why it matters

Clear test cases turn a vague hope that it works into checks a computer runs each time.

## Common mistake

Packing many checks into one test case. When it fails, you cannot tell which part broke.

## Three principles

- **Input, steps, result.** The three parts.
- **One thing each.** One reason to fail.
- **Named for what it checks.** The name explains the fail.

## Related terms

- [Software Testing](https://learn.benibix.com/term/development/software-testing)
- [Assertion](https://learn.benibix.com/term/development/assertion)
- [Test Suite](https://learn.benibix.com/term/development/test-suite)
- [Unit Test](https://learn.benibix.com/term/development/unit-test)
- [Happy Path](https://learn.benibix.com/term/design/happy-path)
- [Test Fixture](https://learn.benibix.com/term/development/test-fixture)
- [Edge Case](https://learn.benibix.com/term/design/edge-case)

---

Source: https://learn.benibix.com/term/development/test-case
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
