I've updated my outline a bit and fleshed it out some. This is the new outline, so please feel free to comment.
- Introduction
- problem
- Documentation is an expensive anchor around a team's neck
- Lots of money to produce (40% on current project)
- Expensive to change (increases inertia and cost of change)
- Difficult to make comprehensive (need source anyways)
- Need something different that will promote minimal inertia, cost, and is accurate and comprehensive.
- Agile Developers write tests for code as it is developed
- Tests assert behavior of system (create invariant)
- Tests provide record of development stream (thought processes of developer)
- Tests change as code changes
- Can tests be used as documentation?
- Who is our audience and what do they need?
- Application programmers -- users of our libraries
- Concerned with finding out what they want to know and getting back to work quickly.
- Concerned with most common usage scenarios most times, but still care about exception cases. Order of tests not important
- Maintenance programmers -- modifiers and extenders of our libraries
- Concerned with understanding underlying design and decisions
- Need guide through code. Order of tests important to them.
- Evaluators -- tire kickers
- Want to get moving quickly
- Less concerned with tests than sample code and quick starts
- Still want to understand architecture and design as part of evaluation, so will act as maintenance programmer in some ways.
- My contention is that tests can do part of the job, but some text is still needed
- Description of Caching design -- equivalent to short text and few UML diagrams
- Basic functions (add, remove, get, flush)
- Factories and equivalency of CacheManagers
- Background operations
- Liveliness of cache references (missing test???)
- Components of a good test
- 3 A-s (Bill Wake)
- Arrange
- Act
- Assert
- Strong names for everything
- Test name tells what is being tested. Makes interesting tests easier to find
- Good variable names inside tests. Makes code easier to read
- Clear assertions. Defines purpose of test. Assertion should assert strongest thing that can be said about test. Should show thought into what underlying code does
- Suite name should tell reader what task fixture is testing/documenting
- Test sufficiency -- do I tell the whole story with my tests
- Capturing design decisions
- Covering interesting use cases
- Showing error behavior
- Interactions with the environment
- Test organization for different audiences
- Application Programmers want to find common scenarios easily
- Maintenance Programmers want to follow original developer's train of thought
- Conclusion: What prose and UML are needed to supplement these tests
- Future directions in Tests as Documentation (Automation topics mostly)
- Final question -- Did using tests as documentation save me anything?