Concept: Test as Documentation
Question
How can tests serve as documentation?
Hint
Read a list of test names — do they tell you what the code does?
Explanation
Well-named tests serve as living documentation because their names describe the expected behavior of the code. Reading the test names tells you what the code should do: 'returns empty array for no input', 'throws on negative numbers', 'caches repeated calls'. Unlike static documentation, tests are always up-to-date because they run against the actual code.
Related Resources
Related Lessons
- Test Best Practices
Writing maintainable tests.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.