Packaging Tests with Code
Many languages use packages or modules as a mechanism to help organize your classes. Many of these provide additional access privileges to code in the same package. Java has a special access level for things in the same package. Ruby modules provide namespaces and are the basis for mixins. Python modules are like classes, but its packages are purely organizational. But be careful. The Perl package declaration defines the name for the class not just the namespace it falls within. This difference is crucial as we will see in a moment.
The privileges of shared package membership give you access to more members of your software under test. Let’s consider how this would impact the testability of the Java code in Listing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access