←back to thread

Unit tests as documentation

(www.thecoder.cafe)
174 points thunderbong | 1 comments | | HN request time: 0.209s | source
1. HelloNurse ◴[] No.41880713[source]
Meaningful test names are unimportant compared to sensible test organization and understandable test content: meaningful test fixtures, helper functions etc. to reduce repetitions; no dependencies on test execution order and other capital sins; straightforward and concise patterns like invoking the ordinary validation of object results instead of inspecting them ad-hoc or tables of simple inputs and expected outputs.

Simple tests don't really need descriptive names because what they test should be obvious, while special tests need more than a good name to be documented enough: comments (e.g. why can crazy cases actually occur), links, extra effort to write them clearly, etc.