Why think unit tests should be in their own source code hierarchy instead of side-by-side

pineapple meapineapple at gmail.com
Sun Mar 25 16:22:32 UTC 2018


I really like `unittest`. It's my personal conviction that a 
developer should not be able to view the documentation, tests, or 
implementation for some part of a code base in isolation. 
`unittest` makes it easier for me to work this way.

Automated tests are vital for stability and documentation is 
vital for maintainability and making it possible for others to 
understand your code. But when they aren't right there in the 
same place as the implementation, I've noticed that it is the 
inevitable habit of developers to think of tests and 
documentation as second-class, if they are thought of at all. The 
developer updates the implementation and doesn't think to update 
the tests or the docs. This happens a few times. Then instead of 
updating the tests to work with the updated implementation, the 
tests are discarded as an inconvenience. And then end users 
become confused by docs that have since become inapplicable.


More information about the Digitalmars-d-announce mailing list