SECAI Core · phase 12 of 15 · noun
Unit test
The developer writes a simple 'pass/no pass' test for code. This ensures that a particular block of code performs the exact action intended, and provides the exact output expected.
The Explain card
- Plain English
- A unit test is a small, automated pass or fail check that one piece of code does exactly what it should, producing the exact output expected for a given input.
- Example
- A function is supposed to strip injection markers from user input before it reaches the model. A unit test feeds it a string containing "ignore previous instructions" and asserts the sanitised output no longer contains that phrase.
- Why it matters
- Security controls are code, and code breaks silently when someone refactors it. Unit tests turn "we think the filter works" into proof that runs on every build.
- Hook
- One block, one question, one yes or no.
Word knowledge
How the word is built, where it came from, and what it sits beside in memory.
In a sentence
A unit test checks whether the model gateway rejects a prompt containing a disallowed tool command.
Why these words
- unit Latin unus, one, through New Latin unitas and English unity identifies one separately considered part
- test Latin testa, an earthen pot used in assaying metals names the examining procedure
Where it came from
- Origin
- an English compound formed from unit and test
- Entered the language
- 1950s
- What changed
- Unit developed from the idea of oneness into a separately considered component, while test shifted from assaying metals to examination; computing joined them as a specialized phrase.
How it is spelled
- Pattern
- unit begins with u pronounced /juː/, as in use
- Pattern
- test uses a short e in a closed syllable
- Pattern
- the phrase is normally written as two separate words
Spelled like
- unity
- unify
- best
- rest
Broken into chunks
-
unit
- unity
- unite
- unify
-
test
- tester
- testing
- testable
What it sits beside
Same subject
- test case
- test suite
- integration test
- regression test
- assertion
Same shape
- integration test
- acceptance test
- penetration test
software test levels
- unit test
- integration test
- system test
- acceptance test
automated testing vocabulary
- test runner
- test fixture
- test suite
Where it sits in the deck
Phase 12: Defensive Technologies and Secure Development Practices
Map defences directly to the attacks just catalogued — the technical controls, secure coding practices, and protective tools that harden AI and traditional systems alike.