O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required