Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Test case, boundary case?

También llamado: test case · boundary case

Definition 1.9 High School Computer Science · Capítulo 1 — Specifications, Assertions and Tests

A test case is an input for which the expected result is known in advance, from the specification, together with that expected result. A test case passes when the function returns the expected result and fails otherwise. A boundary case is a test case at the edge between two kinds of input that the specification treats differently.

The four kinds of year in the specification of leap_year, with one test year in each. Sam’s three tries came from the two outer kinds and from the innermost one, never from the third.
The four kinds of year in the specification of leap_year, with one test year in each. Sam’s three tries came from the two outer kinds and from the innermost one, never from the third.
The paths through the corrected function. The five tests reach every return; the last one in both of its outcomes.
The paths through the corrected function. The five tests reach every return; the last one in both of its outcomes.

Ejemplos

Example 1.11 (Tests for leap_year)

One year of each kind: 20232023, 20242024, 19001900, 20002000; the edge of the precondition: 15831583, which is not a leap year. Sam’s original function fails exactly one of these five tests, the one for 19001900. Any set of tests that misses the third kind misses her bug, however many years it contains.

Leer en el capítulo →