« 15. Conclusion | Main | 13. Architectural Patterns »
November 07, 2004
14. Architectural Pattern - Three-Tier Testing Architecture
Create three layers of test code: Tool Layer, Application Testing Interface Layer and Test Case Layer.
It is a well established idea in distributed object architecture to divide an application into separate tiers. The first tier encapsulates the presentation logic, the second tier the business logic, and the third tier the data storage logic.12 Using this paradigm, application maintenance costs are reduced since components inside each tier can change without impacting other tiers. The same principle can be applied to customer testing architecture.
Test code can be separated into three layers: the Tool Layer, the Application Testing Interface (ATI) Layer and the Test Case Layer. Each layer has a specific responsibility, with the overall goal of reducing the maintenance costs of tests and facilitating new test creation.
Tool Layer
The Tool Layer's responsibility is to provide an extensive Application Programming Interface (API) to facilitate test writing. For instance, the tool can allow tests to find and interact with objects such as buttons, forms, and tables. Each tool is generic such that it can be used to write tests for various applications of a specific type (e.g. web, .NET or Java). Some tools have capabilities to test applications of several types.
Test tools usually fall into two types: record-playback (e.g. QuickTest13 and programmer-oriented. Using a record-playback tool, test developers can quickly start recording tests and playing them back. However, the code that is generated by the tool is usually not object-oriented and uses a proprietary language. Tools that are programmer-oriented are meant to be used by someone with programming experience. There is usually no record and playback mechanism because test developers are expected to write the tests themselves. The advantage of these tools is that they use a standard object-oriented language, which makes them very suitable to using design patterns.
Application Testing Interface (ATI) Layer
The ATI Layer14 is responsible for consolidating all functions common to multiple tests. Every application will have a specific ATI Layer. For instance, each application is sufficiently unique as to require different navigations and assertions. Thus, the common ones contained in this layer would vary between applications. The ATI Layer is in effect a utility service provider for individual tests. It offloads the majority of the work that each test would otherwise be required to do.
The Template, Domain Test Object, Object Genie, and Transporter patterns are all examples of ATI layer code. The ATI Layer uses the tool (from the Tool Layer) to implement each pattern's details. If the tool or the application changes, then the corresponding ATI code would need to be updated to accommodate the changes. The ATI layer is the primary factor in lowering maintenance costs, since a well designed ATI will encapsulate many common navigations and checks that are used by test cases in the Test Case Layer.
Test Layer
The purpose of the Test Layer is to outline specific inputs and expected outputs for each test. The Test Layer relies heavily on the ATI Layer and as a result, is quite brief. Ideally, the Test Layer contains only data unique to each test. For this reason, the tests are insulated from changes in the application. Examples of Test Layer code are the subclasses of a Template, and the tests that use an Object Genie, Transporter, or DTO.
Posted by Misha Rybalov at November 7, 2004 08:12 PM