Test-driven development: Difference between revisions

Content deleted Content added
mention unit testing early; Improve wording
Code visibility: add missing word
Line 69:
 
===Code visibility===
Test code needs access to the code it is testing, but testing should not compromise normal design goals such as [[information hiding]], encapsulation and the [[separation of concerns]]. Therefore, unit test code is usually located in the same project or [[Module (programming)|module]] as the code being tested.
 
In [[object oriented design]] this still does not provide access to private data and methods. Therefore, extra work may be necessary for unit tests. In [[Java (programming language)|Java]] and other languages, a developer can use [[Reflection (computer science)|reflection]] to access private fields and methods.<ref>{{cite web