Test cases for a text field
A text field is tested with the values it will meet, not only with the one the form was designed for. These are the cases, each with a real value and what it usually breaks.
What should a text field be tested with?
With what users and data really put into it, beyond the name the form was designed around: nothing at all, spaces nobody can see, a value at the length limit and one past it, letters outside ASCII, numbers and dates written another way, words a parser reads as something else, and characters that only cause trouble in an export. The sections below take them one at a time. Every value comes from the catalogue, with what it usually breaks, and leads to what a correct application does instead.
What do I check after each value?
The same five things every time:
- Is it stored as typed? Open the record again and compare.
- Do the browser and the server agree? A value the form accepts and the server rejects, or the other way round, is one of the most common findings.
- Does the message name the problem? “Invalid input” for a value one character too long is a defect of its own.
- Does it survive the round trip? Search for it, edit it, see it in a list.
- Does it survive the export? Open the CSV or the spreadsheet the application produces.
Empty, spaces and invisible characters
Test the boundary between empty and filled in. A field that trims spaces on one side and not on the other ends up with a value that is empty to one layer and filled in to the next.
The browser counts the field as filled and the server counts it as empty, or the other way round.
whitespace/space-onlyA field that looks empty but is not: required-field validation passes, and the record has no usable name.
whitespace/zwsp-only KowalskiSorting puts the record at the top of every list, and exact-match search never finds it.
whitespace/leading-space KowalskiLogin and e-mail comparisons differ between browser and server; the account is created but cannot be found.
whitespace/trailing-spaceLength and limits
Test one character under the limit, the limit itself and one over it, then a value far beyond it. Check whether the limit counts characters or bytes: in UTF-8 a letter outside ASCII is one character and two bytes or more.
The classic column width: one character short of the limit, exactly at it, and one over it are three different code paths.
length-bombs/len-255 256 × aOne character over the classic limit, which is where silent truncation usually happens.
length-bombs/len-256 128 × ą128 characters but 256 bytes: a field limited in bytes rejects a value the interface said was fine.
length-bombs/bytes-vs-chars 65,535 × aThe limit of the most common text column type, where crossing it usually produces a raw database error.
length-bombs/len-65535Letters outside ASCII and Unicode
Test the letters your users have in their names, and the characters that change how text is counted, compared or drawn.
Encoding narrower than the full character set replaces these with question marks, and the name is corrupted on save.
locale-pl/diacritics-full éThe same letter written as a base plus a combining mark compares as different from the single-character form.
unicode-text/combining-acute Jan😀KowalskiA character outside the basic plane in a name field breaks byte-length limits and databases configured for narrow encodings.
unicode-text/emoji-in-name raporttxt.exeA direction-override character makes the text render reversed: the value shown to the user is not the value stored.
unicode-text/rtl-overrideWords a parser reads as something else
Test the words that mean “no value”, “false” or “not a number” to a program somewhere between the field and the database.
Serializers and loosely typed interfaces turn the text into an absent value; the field looks saved and comes back empty.
magic-values/word-null noYAML 1.1 and several config parsers read the unquoted word no as boolean false - and NO is the country code for Norway.
magic-values/bool-no NaNNumeric parsers accept it, and then every comparison against it is false - filters and sorting quietly drop the row.
magic-values/word-nan undefinedOften the result of a bug elsewhere, so a real value spelled this way is indistinguishable from a defect.
magic-values/word-undefinedNumbers
Test the edges of the number type, a negative value where none was expected, and numbers written the way another country writes them.
Quantity, price and count fields that never expected a negative value; often accepted and only noticed at invoicing.
numbers-extreme/minus-one 3,14The decimal separator used across most of Europe; parsers expecting a dot read it as a thousands separator or reject it.
numbers-extreme/comma-decimal 2147483648One past the most common integer limit - where counters, identifiers and quantities wrap to a negative number.
numbers-extreme/int32-max-plus-one 9007199254740992Above this value browsers and many interfaces stop representing whole numbers exactly, so an identifier returned by the server no longer matches what the user sees.
numbers-extreme/js-safe-plus-oneDates
Test dates that do not exist, dates that can be read two ways, and years outside the usual range.
A date that cannot exist; naive parsers roll it over to the second of March instead of refusing it.
dates-impossible/feb-30 29.02.2026Valid in some years and not in others, so the same input is correct or incorrect depending on the year field next to it.
dates-impossible/feb-29-non-leap 03/04/2026The same text means March or April depending on convention, and nothing on screen says which was assumed.
dates-impossible/ambiguous-day-month 01.01.10000Five-digit years break fixed-width parsing and column formats without producing an obvious error.
dates-impossible/year-10000Values that break only in the export
Test what happens after the form. A value that passes validation can still break the file the application exports, and the spreadsheet of whoever opens it.
A value starting with an equals sign is treated as a formula by spreadsheet software; the exported file shows a computed result instead of the data.
export-breakers/formula-equals Kowalski,JanA comma inside a value splits one column into two unless the value is quoted correctly at every export step.
export-breakers/csv-comma 007Codes lose their leading zeros the moment a spreadsheet treats the column as numeric.
export-breakers/leading-zero-code 1234567890123456789Spreadsheets keep about fifteen significant digits, so long identifiers come back rounded and in exponential notation.
export-breakers/sheet-precisionFile names
Test a field whose value becomes a file name with names a file system rejects or reads differently.
A device name reserved by one operating system; a file with this name cannot be created and the failure often surfaces as a generic error.
filenames-paths/reserved-con report.Trailing dots are silently removed by some file systems, so the stored name differs from the requested one.
filenames-paths/trailing-dot report.txt.exeInterfaces hiding known extensions show this as report.txt, so the user sees a document and gets a program.
filenames-paths/double-extension ..Two dots mean the parent directory; the shortest possible traversal test.
filenames-paths/dotdotHow do I go through all of them quickly?
With the palette, one shortcut per value: click the field, press AltShiftN , look at the result, and press it again for the next. When a value breaks something, AltShiftB copies a report block for the ticket. Getting started takes about two minutes.
For an automated test, nkb emit prints any pack as JSON, CSV or one value per line:
$ nkb emit length-bombs --format json > length-bombs.json
The catalogue holds 102 values in 9 packs, and the packs show every one of them.