Design For TestabilityDesign For Testability
A forgotten design patternA forgotten design pattern
Rohit NayakRohit Nayak
Talentica SoftwareTalentica Software
The Anti-PatternThe Anti-Pattern
If it works, If it works,
its the developer, its the developer, if not it's QAif not it's QA
DesignDesign for Testabilityfor Testability – The aspects of the – The aspects of the product design process whose goal is to product design process whose goal is to ensure that the testability of the end product ensure that the testability of the end product is is competently and sufficiently developed.competently and sufficiently developed.
Design for DiagnosabilityDesign for Diagnosability – the aspects of – the aspects of the Diagnostic Engineering process that focus the Diagnostic Engineering process that focus on improving the product design, with the on improving the product design, with the intent of optimizing the extent to which faults intent of optimizing the extent to which faults within the end product can be confidently, within the end product can be confidently, unambiguously and efficiently identifiedunambiguously and efficiently identified..
“ “Testability is a design issue and Testability is a design issue and needs to be addressed with the needs to be addressed with the design of the rest of the system. design of the rest of the system. Projects that defer testing to the Projects that defer testing to the later stages of a project will find their later stages of a project will find their programmers unwilling to consider programmers unwilling to consider testability changes by the time testability changes by the time testers actually roll onto the project testers actually roll onto the project and start making suggestions. and start making suggestions. Testability takes cooperation, Testability takes cooperation, appreciation and a team appreciation and a team commitment to reliability.”commitment to reliability.”
Testability and AutomationTestability and Automation
Testability is a critical aspect of successful test automation Testability is a critical aspect of successful test automation efforts:efforts:
Automation requires testability.Automation requires testability. Whether testing via an Whether testing via an API or a GUI, some accommodations to testability are API or a GUI, some accommodations to testability are necessary for successful automation. If you’re going to have to necessary for successful automation. If you’re going to have to do it, why not plan for it up front? do it, why not plan for it up front?
Successful automation requires a focus on testability.Successful automation requires a focus on testability. Again, regardless of approach, the greater the emphasis on Again, regardless of approach, the greater the emphasis on testability within the development team, the more likely testability within the development team, the more likely automated testing will successful. automated testing will successful.
Test automation always affects test veracity to some Test automation always affects test veracity to some degree. degree. Automating tests always makes them somewhat Automating tests always makes them somewhat different from actual customer usage. Wise testers will different from actual customer usage. Wise testers will understand these deviations and develop compensating understand these deviations and develop compensating testing strategies, rather than act as though it can be testing strategies, rather than act as though it can be eliminated. eliminated.
Good Automated Tests areGood Automated Tests are
Repeatable Repeatable Easy to Write Easy to Write Easy to Understand Easy to Understand Fast Fast
Coding For TestabilityCoding For Testability
Expose application data Expose application data Choose automation-friendly third-Choose automation-friendly third-
party controls party controls Uniquely name application pages and Uniquely name application pages and
objects objects Add “hidden” controls Add “hidden” controls Modify custom controls Modify custom controls Externalize functions in a Public API Externalize functions in a Public API
Coding For Testability - 2Coding For Testability - 2
Use proper naming conventions Use proper naming conventions Use only standard widgets Use only standard widgets Expose “hidden” controls Expose “hidden” controls Use unique page names Use unique page names Composition in manageable Composition in manageable
componentscomponents Production environment can be Production environment can be
simulated in test environmentsimulated in test environment
Design criteriaDesign criteria Layering (e.g., user interface, application Layering (e.g., user interface, application
kernel, database access)kernel, database access) Modularization: strong cohesion, lose coupling Modularization: strong cohesion, lose coupling
localization of function localization of test localization of function localization of test Limited special cases high test coverage with Limited special cases high test coverage with
few testsfew tests Errors are raised where they occur (not later)Errors are raised where they occur (not later) System can be parameterized (e.g., Date) by System can be parameterized (e.g., Date) by
the test environmentthe test environment Easy debugging (localizing errors)Easy debugging (localizing errors)
The Value PropositionThe Value Proposition
Developers write code, but the real Developers write code, but the real mission is to ship softwaremission is to ship software
Since detecting and fixing errors is Since detecting and fixing errors is such a major part of the such a major part of the development effort, it's worth our development effort, it's worth our time as developers to invest in time as developers to invest in feedback mechanisms to find errors feedback mechanisms to find errors more quicklymore quickly
Top Related