Edge Case

Noun · Development

Definitions

  1. An input or condition at the extreme boundary of expected parameters — the empty string, the null value, the list with exactly one element, the date February 29th. Where most bugs live and most developers forget to test.

    In plain English: An unusual or extreme situation that a program might encounter — the weird cases that break things, like what happens when a form field is empty or has 10,000 characters.

  2. The cousin of edge cases are corner cases (at the intersection of two boundaries) and boundary cases (at the exact boundary value). Good testing strategy focuses on these boundaries because that's where off-by-one errors, type coercions, and overflow bugs live.

    Example: 'What happens when the user submits an empty form? What about a form with 10MB of text? What about Unicode right-to-left characters? Those edge cases are where the bugs are.'

    Source: testing taxonomy

Origin Story

The unusual input that reveals your assumptions were wrong

**Edge case** (and its cousin, **corner case**) comes from engineering and mathematics, where 'edge' refers to the boundary of a parameter space. An edge case occurs at the extreme end of operating conditions -- zero, maximum, negative, empty, null.

In software, edge cases are the inputs nobody thinks about during development: a user with no name, a file with zero bytes, a date of February 29, a string containing emoji, an integer at MAX_INT. They're where bugs hide because developers test the happy path.

A **corner case** is the intersection of multiple edge conditions simultaneously -- the geometric analogy being where two edges meet. Software that handles edge cases gracefully is robust; software that doesn't is just a demo. As the saying goes: 'There are 2 hard problems in computer science: naming things, cache invalidation, and off-by-one errors.'

Coined by: Engineering/mathematics (general usage)

Context: Adopted by software engineering from general engineering

Fun fact: Falsehoods programmers believe about names, time zones, addresses, and phone numbers have become a famous genre of blog posts. Each one is essentially a catalog of edge cases: names can be one character, time zones can have 15-minute offsets, and some countries have no postal codes.

Related Terms