←back to thread

Unit tests as documentation

(www.thecoder.cafe)
94 points thunderbong | 1 comments | | HN request time: 0.204s | source
Show context
rglover ◴[] No.41872038[source]
Just write the docs. A simple template:

- What is it?

- What does it do?

- Why does it do that?

- What is the API?

- What does it return?

- What are some examples of proper, real world usage (that don't involve foo/bar but instead, real world inputs/outputs I'd likely see)?

replies(3): >>41872068 #>>41872141 #>>41873752 #
croes ◴[] No.41872068[source]
Why is a hard question.

And what should be obvious or it’s still too complex.

replies(1): >>41872144 #
rglover ◴[] No.41872144[source]
If why is hard it may not need to exist. For example:

"This function exists to generate PDFs for reports and customer documents."

"This endpoint exists to provide a means for pre-flight authorization of requests to other endpoints."

replies(1): >>41872655 #
1. croes ◴[] No.41872655[source]
Isn’t that the same as the what?