-
Book Overview & Buying
-
Table Of Contents
Software Architecture with C++ - Second Edition
By :
It’s not enough to distinguish between different types of tests and learn a particular testing framework (or several). When you start testing your actual code, you will soon notice that not all classes can be tested easily. Sometimes, you may feel the need to access private attributes or methods. Resist this urge if you want to maintain the principles of good architecture! Instead, consider either testing the business requirements that are available through the type’s public API or refactoring the type so that there’s another unit of code you can test.
The problem you may be facing is not that the testing frameworks are inadequate. Usually, what you encounter are inappropriately designed classes. Even though your classes may behave correctly and may look correct unless they allow for testing, they are not designed correctly.
The good news is that testing reveals flaws in class design. It means...