SlideShare una empresa de Scribd logo
1 de 14
Descargar para leer sin conexión
!

TF

AM!Half(day!Tutorial!
11/12/2013!8:30!AM!
!
!
!
!
!

"Design for Testability: A
Tutorial for Devs and Testers"
!
!
!

Presented by:
Peter Zimmerer
Siemens AG
!
!
!
!
!
!
!
!
!

Brought(to(you(by:(
!

!
!
340!Corporate!Way,!Suite!300,!Orange!Park,!FL!32073!
888(268(8770!H!904(278(0524!H!sqeinfo@sqe.com!H!www.sqe.com
Peter Zimmerer
Siemens AG
Peter Zimmerer is a principal engineer at Siemens AG, Corporate
Technology, in Munich, Germany. For more than twenty years Peter has
been working in the field of software testing and quality engineering. He
performs consulting, coaching, and training on test management and test
engineering practices in real-world projects, driving research and
innovation in this area. An ISTQB® Certified Tester Full Advanced Level,
Peter is a member of the German Testing Board, has authored several
journal and conference contributions, and is a frequent speaker at
international conferences. Contact Peter at peter.zimmerer@siemens.com.
Siemens Corporate Technology | November 2013

Design for Testability:
A Tutorial for Devs and Testers

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Contents
‡ What is testability all about?
‡ What are the influencing factors and constraints of testability?
‡ Why is testability so important?
‡ Who is responsible and who must be involved to realize design for
testability?
‡ How can we improve, foster, and sustain the testability of a system?
‡ How can we innovate and renovate design for testability in our
projects?

Æ A new, comprehensive strategy on
design for testability over the whole lifecycle of a system
Page 2

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
A story on missing testability …
The Therac-25 was a radiation therapy machine
produced by Atomic Energy of Canada Limited
(AECL) after the Therac-6 and Therac-20 units.
It was involved in at least six accidents between
1985 and 1987, in which patients were given
massive overdoses of radiation, approximately
100 times the intended dose. These accidents
highlighted the dangers of software control of
safety-critical systems, and they have become
a standard case study in health informatics and
software engineering.
A commission concluded that the primary reason should be attributed to the bad
software design and development practices, and not explicitly to several coding
errors that were found. In particular, the software was designed so that it
was realistically impossible to test it in a clean automated way.
http://en.wikipedia.org/wiki/Therac-25
Page 3

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Testability – Theoretical definitions
Testability is the ease of validation, that the software meets the requirements. Testability is broken
down into: accountability, accessibility, communicativeness, self-descriptiveness, structuredness.
Barry W. Boehm: Software Engineering Economics, Prentice Hall,1981

Testability is the degree to which, and ease with which, software can be effectively tested.
Donald G. Firesmith: Testing Object-Oriented Software, Proceedings of the Object EXPO Europe, London (UK), July 1993

The degree to which a system or component facilitates the establishment of test criteria and the
performance of tests to determine whether those criteria have been met.
The degree to which a requirement is stated in terms that permit establishment of test criteria and
performance of tests to determine whether those criteria have been met.
IEEE Standard Computer Dictionary: A Compilation of IEEE Standard Computer Glossaries. New York, NY, 1990

The testability of a program P is the probability that if P contains faults, P will fail under test.
Dick Hamlet, Jeffrey Voas: Faults on its Sleeve. Amplifying Software Reliability Testing, in Proceedings of the 1993 International
Symposium on Software Testing and Analysis (ISSTA), Cambridge, Massachusetts, USA, June 28–30, 1993

Software testability refers to the ease with which software can be made to demonstrate its faults
through (typically execution-based) testing. Len Bass, Paul Clement, Rick Kazmann: Software Architecture in Practice
The degree to which an objective and feasible test can be designed to determine whether a
requirement is met. ISO/IEC 12207
The capability of the software product to enable modified software to be validated. ISO/IEC 9126-1
Degree of effectiveness and efficiency with which test criteria can be established for a system,
product or component and tests can be performed to determine whether those criteria have been
met. ISO/IEC 25010, adapted from ISO/IEC/IEEE 24765
Page 4

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Testability – Factors (1)

Control(lability)
‡ The better we can control the system (in isolation),
the more and better testing can be done, automated, and optimized
‡ Ability to apply and control the inputs to the system under test
or place it in specified states (for example reset to start state, roll back)
‡ Interaction with the system under test (SUT) through control points
Control(lability)
Visibility / observability
Visibility / observability
‡ What you see is what can be tested
‡ Ability to observe the inputs, outputs, states, internals, error conditions,
resource utilization, and other side effects of the system under test
‡ Interaction with the system under test (SUT) through observation points
Page 5

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Testability – Factors (2)
Availability, operability

‡ The better it works, the more efficiently it can be tested
‡ Bugs add overhead for analysis and reporting to testing
‡ No bugs block the execution of the tests

Simplicity, consistency, and decomposability

‡
‡
‡
‡

The less there is to test, the more quickly we can test it
Standards, (code / design) guidelines, naming conventions
Layering, modularization, isolation, loose coupling, separation of concern, SOLID
Internal software quality (architecture, design, code), technical debt

Stability

‡ The fewer the changes, the fewer the disruptions to testing
‡ Changes are infrequent, controlled and do not invalidate existing tests
‡ Software recovers well from failures

Understandability, knowledge (of expected results)

‡ The more (and better) information we have, the smarter we will test
‡ Design is well understood, good and accurate technical documentation

@Microsoft: SOCK – Simplicity, Observability, Control, Knowledge
Page 6

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Testability – Factors (3)
Visibility /
Observability
Control(lability)

Answer

Question
Availability
Operability
Stability

Oracle
Simplicity
Understandability
Knowledge

Page 7

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Testability – Constraints
How we design and build the system affects testability
Testability is the key to cost-effective test automation
Testability is often a better investment than automation
‡ Test environment: stubs, mocks, fakes, dummies, spies
‡ Test oracle: assertions (design by contract)
Æ Implemented either inside the SUT or inside the test automation
Challenges for testability
‡ Size, complexity, structure, variants, 3rd party components, legacy code
‡ Regulatory aspects
‡ You cannot log every interface (huge amount of data)
‡ Conflicts with other non-functional requirements like encapsulation,
performance or security, and impacts system behavior
‡ Non-determinism: concurrency, threading, race conditions, timeouts,
message latency, shared and unprotected data
Page 8

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Testability is affected / required by new technologies
Example: Cloud computing
Cloud testability – the negative
– Information hiding and remoteness
– Complexity and statefulness
– Autonomy and adaptiveness
– Dependability and performance
– Paradigm infancy (temporary)
Cloud testability – the positive
+ Computational power
+ Storage
+ Virtualization

Testing requires lots of resources
and the cloud is certainly powerful enough to handle it
ndle
Reference: Tariq M. King, Annaji S. Ganti, David Froslie:
Towards Improving the Testability of Cloud Application Services, 2012

P
Page 9

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Design for Testability (DfT) – Why?
Testability § How easy / effective / efficient / expensive is it to test?
Can it be tested at all?
Increase depth and quality of tests – Reduce cost, effort, time of tests

‡ More bugs detected (earlier) and better root cause analysis with less effort
‡ Support testing of error handling and error conditions, for example to test how a
component reacts to corrupted data
‡ Better and more realistic estimation of testing efforts
‡ Testing of non-functional requirements, test automation, regression testing
‡ Cloud testing, testing in production (TiP)

Reduce cost, effort, and time for debugging, diagnosis, maintenance
‡ Typically underestimated by managers, not easy to measure honestly

Provide building blocks for self-diagnosing / self-correcting software
Possible savings ~10% of total development budget
(Stefan Jungmayr, http://www.testbarkeit.de/)
Simplify, accelerate, and power up the testing
Focus the testing on the real stuff … and have more fun in testing …
Page 10

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Educate stakeholders on benefit of DfT

Design for Testability (DfT) – Who?
Joint venture between architects (+ developers) and testers
‡ Collaboration between different stakeholders
‡ Requires accountability and clear ownership
Testability must be built-in by architects (+ developers)
‡ Pro-active strategy in tactical design:
design the system with testability as a key design criterion
‡ Testers (test automation engineers) must define testability requirements
to enable effective and efficient test automation
Contractual agreement between design and test
Balancing production code and test code
‡ Production code and test code must fit together
‡ Manage the design of production code and test code
as codependent assets
Page 11

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Educate stakeholders on benefit of DfT

Design for Testability (DfT) – How?
Suitable testing architecture, good design principles
ples
Interaction with the system under test through
well-defined control points and observation points
nts
Additional (scriptable) interfaces, ports, hooks, mocks, interceptors
for testing purposes (setup, configuration, simulation, recovery)
Coding guidelines, naming conventions
Internal software quality (architecture, code)

Control(lability)

Visibility / observability
Built-in self-test (BIST), built-in test (BIT)
Consistency checks (assertions, design by contract, deviations)
Logging and tracing (AOP, counters, monitoring, probing, profiling)
Diagnosis and dump utilities, black box (internal states, resource
utilization, anomalies at runtime)
Think test-first (xTDD): how can I test this?

Page 12

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Architectural and design patterns (1)

Tester

Use layered architectures, reduce number of dependencies
Use good design principles
‡ Strong cohesion, loose coupling, separation of concerns

SUT

Real or simulated
environment

Component orientation and adapters ease integration testing
‡ Components are the units of testing
‡ Component interface methods are subject to black-box testing
Avoid / resolve cyclic dependencies between components
‡ Combine or split components
ble
‡ Dependency inversion via callback interface (observer-observable
design pattern)
Example: MSDN Views Testability guidance
The purpose is to provide information about how to increase the
testability surface of Web applications using the Model-View-Presenter
(M-V-P) pattern. http://msdn.microsoft.com/en-us/library/cc304742.aspx
Page 13

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Architectural and design patterns (2)
Provide appropriate test hooks and factor your design in a way that
lets test code interrogate and control the running system
‡ Isolate and encapsulate dependencies on the external environment
‡ Use patterns like dependency injection, interceptors, introspective
‡ Use configurable factories to retrieve service providers
‡ Declare and pass along parameters instead of hardwire references to
service providers
‡ Declare interfaces that can be implemented by test classes
‡ Declare methods as overridable by test methods
‡ Avoid references to literal values
‡ Shorten lengthy methods by making calls to replaceable helper methods
Promote repeatable, reproducible behavior
‡ Provide utilities to support deterministic behavior (e.g. use seed values)
Æ That’s just good design practice!
Page 14

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Design for Testability (DfT) patterns
Dependency injection
The client provides the depended-on object
to the SUT
Dependency lookup
The SUT asks another object to return the
depended-on object before it uses it
Humble object
We extract the logic into a separate easy-to-test component that is
decoupled from its environment
Test hook
We modify the SUT to behave differently during the test
Reference: Gerard Meszaros: xUnit Test Patterns: Refactoring Test Code, Addison-Wesley, 2007
http://xunitpatterns.com/
Page 15

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Use principles and practices from
clean code developer (CCD)
http://www.clean-code-developer.de/
http://www.clean-code-developer.com/

Page 16

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Interfaces can act as
ƒ control points
Attributes of testability interfaces
ƒ observation points
Indirect Input

Product API

System
under
Test (SUT)

Product Events
Test API

Dependent
Components

Indirect Output

Test Events

‡
‡
‡
‡
‡
‡
‡

Lightweight vs. intrusive
‡ Manual vs. automatable
Realistic vs. artificial
‡ Tester owned vs. developer owned
Control-only vs. visibility-only vs. both
Information-only vs. knowledge
Debug-only (logs / asserts) vs. release build
Internal (embedded) vs. external vs. shipping (documented) feature
NFR (e.g. security) harmless vs. NFR conflict (e.g. security hole)

Page 17

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Logging and tracing
Check the architecture and design.
Check the dynamic behavior
(i.e. communication) of the system.
Detect bugs, including sporadic bugs
like race conditions.

Distributed System

...

Event

Analyze execution, data flow, and system state.
Follow error propagation and reproduce faults.
For this, tracing is essential.
Tracing is important for unit testing,
integration testing, system testing,
system monitoring, diagnosis, …

...

Event

Event Collection

Trace
visualization

Trace

Trace
analysis

Relationship between
trace extraction, trace visualization,
and trace analysis

Start early with a logging and tracing concept!
Page 18

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Further benefits of
good logging and tracing practices
Avoid analysis paralysis – a situation where the test team spends
as much time investigating test failures as they do testing
Support failure matching and (automated) failure analysis
Avoid duplicates in the bug database by using rules of analysis
when deciding if a failure has been previously observed
Backbone of reliable failure analysis
Example: Windows Error Reporting (WER)
‡ Small, well defined set of parameters
‡ Automated classification of issues
‡ Similar crash reports are grouped together
ÆReduced amount of data collected from customers:
bucketing
Page 19

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Diagnosis and dump utilities, black box
(internal states, resource utilization, anomalies at runtime)
Detect, identify, analyze, isolate, diagnose, and reproduce
a bug (location, factors, triggers, constraints, root cause)
in different contexts as effective and as efficient as possible
‡ Unit / component testing:
bug in my unit/component or external unit/component or environment?
‡ Integration testing of several subsystems:
bug in my subsystem or external subsystem or environment?
‡ System of systems testing:
bug in which part of the whole system of systems?
‡ Product line testing in product line engineering (PLE):
bug in domain engineering part or application engineering part?
‡ Bug in system under test (SUT) or test system?
Æ quality of test system is important as well ...
‡ SUT in operation:
maintenance, serviceability at the customer site
Page 20

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Educate stakeholders on benefit of DfT

Strategy for Design for Testability (DfT)
over the lifecycle (1)
Requ

DfT

Arch

‡ Consistently defined and well-known in the project to drive a common
understanding, awareness, and collaboration with clear accountability
‡ Addressed and specified as one important non-functional requirement
from the beginning
‡ Investigated by elicitation techniques (interviews, observation,
brainstorming, story writing, prototyping, personas, reuse, apprenticing)
‡ Included and elaborated in the product backlog
‡ Defined, specified, traced, and updated as a risk item in the risk-based
testing strategy with well-defined mitigation tasks
‡ Balanced with regards to conflicting non-functional requirements
‡ Implemented dependent on the specific domain, system, and
(software) technologies that are available and used
Page 21

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Strategy for Design for Testability (DfT)
over the lifecycle (2)
Requ
u
Educate stakeholders on benefit of DfT

Test

Test
DfT

Arch

‡ Specified and elaborated in a testability guideline for architects,
developers, testers (Æ DfT – How?)
Æ Testability view*/profile in the architectural design approach (
(ADA)
)

‡ Description how to recognize characteristics of the ADA in an artifact
to support an analysis and check of the claimed ADA
‡ A set of controls (controllables) associated with using the ADA
‡ A set of observables associated with using the ADA
‡ A set of testing firewalls within the architecture used for regression testing
(firewalls enclose the set of parts that must be retested, they are imaginary
boundaries that limits retesting of impacted parts for modified software)
‡ A set of preventive principles (e.g. memory / time partitioning):
specific system behavior and properties guaranteed by design (e.g. scheduling,
interrupt handling, concurrency, exception handling, error management)
‡ A fault model for the ADA: failures that can occur, failures that cannot occur
‡ Analysis (architecture-based or code-based) corresponding to the fault model
to detect ADA-related faults in the system (e.g. model checking)
‡ Tests made redundant or de-prioritized based on fault model and analysis

*Additional view to the 4+1 View Model of Software Architecture by Philippe Kruchten
Page 22

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved
Educate stakeholders on benefit of DfT

Strategy for Design for Testability (DfT)
over the lifecycle (3)
Requ
u

Test
DfT

Arch

‡ Included as one important criteria in milestones and quality gates, e.g.:
Æ Check control and observation points in the architecture
Æ Check testability requirements for sustaining test automation
Æ Check logging and tracing concept to provide valuable information
Æ Check testability support in coding guidelines
Æ Check testability needs (especially visibility) for regression testing
‡ Investigated and explored in static testing:
architecture interrogation (interviews, interactive workshops),
architecture reviews, QAW, ATAM*, code reviews
‡ Investigated and explored in dynamic testing:
special testability tour in scenario testing (application touring)

Æ Neglecting testability means increasing technical debt … $$ …
*Architecture-centric methods from SEI, see http://www.sei.cmu.edu/
Page 23

November 12, 2013

Corporate Technology

Summary – Testability and
Design for Testability (DfT)

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Test
Requ
u

DfT

Arch

‡ What?

‡ Why?

‡ Who?

‡ How?
Æ Strategy for Design for Testability (DfT) over the lifecycle
Page 24

November 12, 2013

Corporate Technology

Peter Zimmerer

Unrestricted © Siemens AG 2013. All rights reserved

Más contenido relacionado

La actualidad más candente

Rapid software testing
Rapid software testingRapid software testing
Rapid software testing
Sachin MK
 
5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing
Mary Clemons
 

La actualidad más candente (19)

Rapid software testing
Rapid software testingRapid software testing
Rapid software testing
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
EclipseCon: Test Confessions - What Eclipsers think and do about testing
EclipseCon: Test Confessions - What Eclipsers think and do about testingEclipseCon: Test Confessions - What Eclipsers think and do about testing
EclipseCon: Test Confessions - What Eclipsers think and do about testing
 
Characterizing and Predicting Which Bugs Get Reopened
Characterizing and Predicting Which Bugs Get ReopenedCharacterizing and Predicting Which Bugs Get Reopened
Characterizing and Predicting Which Bugs Get Reopened
 
Predicting Method Crashes with Bytecode Operations
Predicting Method Crashes with Bytecode OperationsPredicting Method Crashes with Bytecode Operations
Predicting Method Crashes with Bytecode Operations
 
Software testing-in-gurgaon
Software testing-in-gurgaonSoftware testing-in-gurgaon
Software testing-in-gurgaon
 
Analytics for smarter software development
Analytics for smarter software development Analytics for smarter software development
Analytics for smarter software development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD)
 
Common Challenges & Best Practices for TDD on iOS
Common Challenges & Best Practices for TDD on iOSCommon Challenges & Best Practices for TDD on iOS
Common Challenges & Best Practices for TDD on iOS
 
Sdlc
SdlcSdlc
Sdlc
 
Case studies of Test Driven Development
Case studies of Test Driven DevelopmentCase studies of Test Driven Development
Case studies of Test Driven Development
 
Agile Testing Overview
Agile Testing OverviewAgile Testing Overview
Agile Testing Overview
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Open Source tools in Continuous Integration environment (case study for agil...
Open Source tools in Continuous Integration environment  (case study for agil...Open Source tools in Continuous Integration environment  (case study for agil...
Open Source tools in Continuous Integration environment (case study for agil...
 
5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing
 
Types of Software Testing: Definition, Objectives and Advantages
Types of Software Testing: Definition, Objectives and AdvantagesTypes of Software Testing: Definition, Objectives and Advantages
Types of Software Testing: Definition, Objectives and Advantages
 
How does pair programming work?
How does pair programming work?How does pair programming work?
How does pair programming work?
 

Destacado

Fundamental Skills for Real Estate Development Professionals I – Financial An...
Fundamental Skills for Real Estate Development Professionals I – Financial An...Fundamental Skills for Real Estate Development Professionals I – Financial An...
Fundamental Skills for Real Estate Development Professionals I – Financial An...
Virtual ULI
 
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
codebits
 
A BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKING
A BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKINGA BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKING
A BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKING
Silvio Cesare
 
Fundamental Skills for Real Estate Development Professionals I – Site Selecti...
Fundamental Skills for Real Estate Development Professionals I – Site Selecti...Fundamental Skills for Real Estate Development Professionals I – Site Selecti...
Fundamental Skills for Real Estate Development Professionals I – Site Selecti...
Virtual ULI
 

Destacado (11)

Fundamental Skills for Real Estate Development Professionals I – Financial An...
Fundamental Skills for Real Estate Development Professionals I – Financial An...Fundamental Skills for Real Estate Development Professionals I – Financial An...
Fundamental Skills for Real Estate Development Professionals I – Financial An...
 
Network testing and debugging
Network testing and debuggingNetwork testing and debugging
Network testing and debugging
 
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
 
Hardware hacking
Hardware hackingHardware hacking
Hardware hacking
 
A BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKING
A BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKINGA BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKING
A BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKING
 
Hardware hacking 101
Hardware hacking 101Hardware hacking 101
Hardware hacking 101
 
Fundamental Skills for Real Estate Development Professionals I – Site Selecti...
Fundamental Skills for Real Estate Development Professionals I – Site Selecti...Fundamental Skills for Real Estate Development Professionals I – Site Selecti...
Fundamental Skills for Real Estate Development Professionals I – Site Selecti...
 
A 12 hour workshop on Introduction to Python
A 12 hour workshop on Introduction to PythonA 12 hour workshop on Introduction to Python
A 12 hour workshop on Introduction to Python
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
 
Real Estate Development Modeling Basics
Real Estate Development Modeling BasicsReal Estate Development Modeling Basics
Real Estate Development Modeling Basics
 
Real Estate Development - Financial Model
Real Estate Development - Financial ModelReal Estate Development - Financial Model
Real Estate Development - Financial Model
 

Similar a Design for Testability: A Tutorial for Devs and Testers

want to contact me login to www.stqa.org
want to contact me login to www.stqa.orgwant to contact me login to www.stqa.org
want to contact me login to www.stqa.org
nazeer pasha
 
Software reliability engineering
Software reliability engineeringSoftware reliability engineering
Software reliability engineering
Mark Turner CRP
 
Top 5 Pitfalls of Test Automation and How To Avoid Them
Top 5 Pitfalls of Test Automation and How To Avoid ThemTop 5 Pitfalls of Test Automation and How To Avoid Them
Top 5 Pitfalls of Test Automation and How To Avoid Them
Sundar Sritharan
 
CHAPTER 15Security Quality Assurance TestingIn this chapter yo
CHAPTER 15Security Quality Assurance TestingIn this chapter yoCHAPTER 15Security Quality Assurance TestingIn this chapter yo
CHAPTER 15Security Quality Assurance TestingIn this chapter yo
JinElias52
 

Similar a Design for Testability: A Tutorial for Devs and Testers (20)

Peter Zimmerer - Passion For Testing, By Examples - EuroSTAR 2010
Peter Zimmerer - Passion For Testing, By Examples - EuroSTAR 2010Peter Zimmerer - Passion For Testing, By Examples - EuroSTAR 2010
Peter Zimmerer - Passion For Testing, By Examples - EuroSTAR 2010
 
want to contact me login to www.stqa.org
want to contact me login to www.stqa.orgwant to contact me login to www.stqa.org
want to contact me login to www.stqa.org
 
Software reliability engineering
Software reliability engineeringSoftware reliability engineering
Software reliability engineering
 
Software Testing Concepts
Software Testing  ConceptsSoftware Testing  Concepts
Software Testing Concepts
 
Continuous delivery test strategies
Continuous delivery test strategiesContinuous delivery test strategies
Continuous delivery test strategies
 
Information hiding based on optimization technique for Encrypted Images
Information hiding based on optimization technique for Encrypted ImagesInformation hiding based on optimization technique for Encrypted Images
Information hiding based on optimization technique for Encrypted Images
 
CLOUD TESTING MODEL – BENEFITS, LIMITATIONS AND CHALLENGES
CLOUD TESTING MODEL – BENEFITS, LIMITATIONS AND CHALLENGESCLOUD TESTING MODEL – BENEFITS, LIMITATIONS AND CHALLENGES
CLOUD TESTING MODEL – BENEFITS, LIMITATIONS AND CHALLENGES
 
Estimating test effort part 1 of 2
Estimating test effort part 1 of 2Estimating test effort part 1 of 2
Estimating test effort part 1 of 2
 
Industrial Training in Software Testing
Industrial Training in Software TestingIndustrial Training in Software Testing
Industrial Training in Software Testing
 
Top 5 Pitfalls of Test Automation and How To Avoid Them
Top 5 Pitfalls of Test Automation and How To Avoid ThemTop 5 Pitfalls of Test Automation and How To Avoid Them
Top 5 Pitfalls of Test Automation and How To Avoid Them
 
Creating and managing test environments best practices for test infrastructur...
Creating and managing test environments best practices for test infrastructur...Creating and managing test environments best practices for test infrastructur...
Creating and managing test environments best practices for test infrastructur...
 
Using language workbenches and domain-specific languages for safety-critical ...
Using language workbenches and domain-specific languages for safety-critical ...Using language workbenches and domain-specific languages for safety-critical ...
Using language workbenches and domain-specific languages for safety-critical ...
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)
 
The best way to design secure software products
The best way to design secure software productsThe best way to design secure software products
The best way to design secure software products
 
Quality & Reliability in Software Engineering
Quality & Reliability in Software EngineeringQuality & Reliability in Software Engineering
Quality & Reliability in Software Engineering
 
Challenges in Security Testing
Challenges in Security TestingChallenges in Security Testing
Challenges in Security Testing
 
Introducing Software Development Technologies
Introducing Software Development TechnologiesIntroducing Software Development Technologies
Introducing Software Development Technologies
 
CHAPTER 15Security Quality Assurance TestingIn this chapter yo
CHAPTER 15Security Quality Assurance TestingIn this chapter yoCHAPTER 15Security Quality Assurance TestingIn this chapter yo
CHAPTER 15Security Quality Assurance TestingIn this chapter yo
 
The Top Ten things that have been proven to effect software reliability
The Top Ten things that have been proven to effect software reliabilityThe Top Ten things that have been proven to effect software reliability
The Top Ten things that have been proven to effect software reliability
 
PROFIBUS and PROFINET system design for the process industry - Andy Verwer
PROFIBUS and PROFINET system design for the process industry - Andy VerwerPROFIBUS and PROFINET system design for the process industry - Andy Verwer
PROFIBUS and PROFINET system design for the process industry - Andy Verwer
 

Más de TechWell

Más de TechWell (20)

Failing and Recovering
Failing and RecoveringFailing and Recovering
Failing and Recovering
 
Instill a DevOps Testing Culture in Your Team and Organization
Instill a DevOps Testing Culture in Your Team and Organization Instill a DevOps Testing Culture in Your Team and Organization
Instill a DevOps Testing Culture in Your Team and Organization
 
Test Design for Fully Automated Build Architecture
Test Design for Fully Automated Build ArchitectureTest Design for Fully Automated Build Architecture
Test Design for Fully Automated Build Architecture
 
System-Level Test Automation: Ensuring a Good Start
System-Level Test Automation: Ensuring a Good StartSystem-Level Test Automation: Ensuring a Good Start
System-Level Test Automation: Ensuring a Good Start
 
Build Your Mobile App Quality and Test Strategy
Build Your Mobile App Quality and Test StrategyBuild Your Mobile App Quality and Test Strategy
Build Your Mobile App Quality and Test Strategy
 
Testing Transformation: The Art and Science for Success
Testing Transformation: The Art and Science for SuccessTesting Transformation: The Art and Science for Success
Testing Transformation: The Art and Science for Success
 
Implement BDD with Cucumber and SpecFlow
Implement BDD with Cucumber and SpecFlowImplement BDD with Cucumber and SpecFlow
Implement BDD with Cucumber and SpecFlow
 
Develop WebDriver Automated Tests—and Keep Your Sanity
Develop WebDriver Automated Tests—and Keep Your SanityDevelop WebDriver Automated Tests—and Keep Your Sanity
Develop WebDriver Automated Tests—and Keep Your Sanity
 
Ma 15
Ma 15Ma 15
Ma 15
 
Eliminate Cloud Waste with a Holistic DevOps Strategy
Eliminate Cloud Waste with a Holistic DevOps StrategyEliminate Cloud Waste with a Holistic DevOps Strategy
Eliminate Cloud Waste with a Holistic DevOps Strategy
 
Transform Test Organizations for the New World of DevOps
Transform Test Organizations for the New World of DevOpsTransform Test Organizations for the New World of DevOps
Transform Test Organizations for the New World of DevOps
 
The Fourth Constraint in Project Delivery—Leadership
The Fourth Constraint in Project Delivery—LeadershipThe Fourth Constraint in Project Delivery—Leadership
The Fourth Constraint in Project Delivery—Leadership
 
Resolve the Contradiction of Specialists within Agile Teams
Resolve the Contradiction of Specialists within Agile TeamsResolve the Contradiction of Specialists within Agile Teams
Resolve the Contradiction of Specialists within Agile Teams
 
Pin the Tail on the Metric: A Field-Tested Agile Game
Pin the Tail on the Metric: A Field-Tested Agile GamePin the Tail on the Metric: A Field-Tested Agile Game
Pin the Tail on the Metric: A Field-Tested Agile Game
 
Agile Performance Holarchy (APH)—A Model for Scaling Agile Teams
Agile Performance Holarchy (APH)—A Model for Scaling Agile TeamsAgile Performance Holarchy (APH)—A Model for Scaling Agile Teams
Agile Performance Holarchy (APH)—A Model for Scaling Agile Teams
 
A Business-First Approach to DevOps Implementation
A Business-First Approach to DevOps ImplementationA Business-First Approach to DevOps Implementation
A Business-First Approach to DevOps Implementation
 
Databases in a Continuous Integration/Delivery Process
Databases in a Continuous Integration/Delivery ProcessDatabases in a Continuous Integration/Delivery Process
Databases in a Continuous Integration/Delivery Process
 
Mobile Testing: What—and What Not—to Automate
Mobile Testing: What—and What Not—to AutomateMobile Testing: What—and What Not—to Automate
Mobile Testing: What—and What Not—to Automate
 
Cultural Intelligence: A Key Skill for Success
Cultural Intelligence: A Key Skill for SuccessCultural Intelligence: A Key Skill for Success
Cultural Intelligence: A Key Skill for Success
 
Turn the Lights On: A Power Utility Company's Agile Transformation
Turn the Lights On: A Power Utility Company's Agile TransformationTurn the Lights On: A Power Utility Company's Agile Transformation
Turn the Lights On: A Power Utility Company's Agile Transformation
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Design for Testability: A Tutorial for Devs and Testers

  • 1. ! TF AM!Half(day!Tutorial! 11/12/2013!8:30!AM! ! ! ! ! ! "Design for Testability: A Tutorial for Devs and Testers" ! ! ! Presented by: Peter Zimmerer Siemens AG ! ! ! ! ! ! ! ! ! Brought(to(you(by:( ! ! ! 340!Corporate!Way,!Suite!300,!Orange!Park,!FL!32073! 888(268(8770!H!904(278(0524!H!sqeinfo@sqe.com!H!www.sqe.com
  • 2. Peter Zimmerer Siemens AG Peter Zimmerer is a principal engineer at Siemens AG, Corporate Technology, in Munich, Germany. For more than twenty years Peter has been working in the field of software testing and quality engineering. He performs consulting, coaching, and training on test management and test engineering practices in real-world projects, driving research and innovation in this area. An ISTQB® Certified Tester Full Advanced Level, Peter is a member of the German Testing Board, has authored several journal and conference contributions, and is a frequent speaker at international conferences. Contact Peter at peter.zimmerer@siemens.com.
  • 3. Siemens Corporate Technology | November 2013 Design for Testability: A Tutorial for Devs and Testers Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Contents ‡ What is testability all about? ‡ What are the influencing factors and constraints of testability? ‡ Why is testability so important? ‡ Who is responsible and who must be involved to realize design for testability? ‡ How can we improve, foster, and sustain the testability of a system? ‡ How can we innovate and renovate design for testability in our projects? Æ A new, comprehensive strategy on design for testability over the whole lifecycle of a system Page 2 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 4. A story on missing testability … The Therac-25 was a radiation therapy machine produced by Atomic Energy of Canada Limited (AECL) after the Therac-6 and Therac-20 units. It was involved in at least six accidents between 1985 and 1987, in which patients were given massive overdoses of radiation, approximately 100 times the intended dose. These accidents highlighted the dangers of software control of safety-critical systems, and they have become a standard case study in health informatics and software engineering. A commission concluded that the primary reason should be attributed to the bad software design and development practices, and not explicitly to several coding errors that were found. In particular, the software was designed so that it was realistically impossible to test it in a clean automated way. http://en.wikipedia.org/wiki/Therac-25 Page 3 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Testability – Theoretical definitions Testability is the ease of validation, that the software meets the requirements. Testability is broken down into: accountability, accessibility, communicativeness, self-descriptiveness, structuredness. Barry W. Boehm: Software Engineering Economics, Prentice Hall,1981 Testability is the degree to which, and ease with which, software can be effectively tested. Donald G. Firesmith: Testing Object-Oriented Software, Proceedings of the Object EXPO Europe, London (UK), July 1993 The degree to which a system or component facilitates the establishment of test criteria and the performance of tests to determine whether those criteria have been met. The degree to which a requirement is stated in terms that permit establishment of test criteria and performance of tests to determine whether those criteria have been met. IEEE Standard Computer Dictionary: A Compilation of IEEE Standard Computer Glossaries. New York, NY, 1990 The testability of a program P is the probability that if P contains faults, P will fail under test. Dick Hamlet, Jeffrey Voas: Faults on its Sleeve. Amplifying Software Reliability Testing, in Proceedings of the 1993 International Symposium on Software Testing and Analysis (ISSTA), Cambridge, Massachusetts, USA, June 28–30, 1993 Software testability refers to the ease with which software can be made to demonstrate its faults through (typically execution-based) testing. Len Bass, Paul Clement, Rick Kazmann: Software Architecture in Practice The degree to which an objective and feasible test can be designed to determine whether a requirement is met. ISO/IEC 12207 The capability of the software product to enable modified software to be validated. ISO/IEC 9126-1 Degree of effectiveness and efficiency with which test criteria can be established for a system, product or component and tests can be performed to determine whether those criteria have been met. ISO/IEC 25010, adapted from ISO/IEC/IEEE 24765 Page 4 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 5. Testability – Factors (1) Control(lability) ‡ The better we can control the system (in isolation), the more and better testing can be done, automated, and optimized ‡ Ability to apply and control the inputs to the system under test or place it in specified states (for example reset to start state, roll back) ‡ Interaction with the system under test (SUT) through control points Control(lability) Visibility / observability Visibility / observability ‡ What you see is what can be tested ‡ Ability to observe the inputs, outputs, states, internals, error conditions, resource utilization, and other side effects of the system under test ‡ Interaction with the system under test (SUT) through observation points Page 5 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Testability – Factors (2) Availability, operability ‡ The better it works, the more efficiently it can be tested ‡ Bugs add overhead for analysis and reporting to testing ‡ No bugs block the execution of the tests Simplicity, consistency, and decomposability ‡ ‡ ‡ ‡ The less there is to test, the more quickly we can test it Standards, (code / design) guidelines, naming conventions Layering, modularization, isolation, loose coupling, separation of concern, SOLID Internal software quality (architecture, design, code), technical debt Stability ‡ The fewer the changes, the fewer the disruptions to testing ‡ Changes are infrequent, controlled and do not invalidate existing tests ‡ Software recovers well from failures Understandability, knowledge (of expected results) ‡ The more (and better) information we have, the smarter we will test ‡ Design is well understood, good and accurate technical documentation @Microsoft: SOCK – Simplicity, Observability, Control, Knowledge Page 6 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 6. Testability – Factors (3) Visibility / Observability Control(lability) Answer Question Availability Operability Stability Oracle Simplicity Understandability Knowledge Page 7 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Testability – Constraints How we design and build the system affects testability Testability is the key to cost-effective test automation Testability is often a better investment than automation ‡ Test environment: stubs, mocks, fakes, dummies, spies ‡ Test oracle: assertions (design by contract) Æ Implemented either inside the SUT or inside the test automation Challenges for testability ‡ Size, complexity, structure, variants, 3rd party components, legacy code ‡ Regulatory aspects ‡ You cannot log every interface (huge amount of data) ‡ Conflicts with other non-functional requirements like encapsulation, performance or security, and impacts system behavior ‡ Non-determinism: concurrency, threading, race conditions, timeouts, message latency, shared and unprotected data Page 8 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 7. Testability is affected / required by new technologies Example: Cloud computing Cloud testability – the negative – Information hiding and remoteness – Complexity and statefulness – Autonomy and adaptiveness – Dependability and performance – Paradigm infancy (temporary) Cloud testability – the positive + Computational power + Storage + Virtualization Testing requires lots of resources and the cloud is certainly powerful enough to handle it ndle Reference: Tariq M. King, Annaji S. Ganti, David Froslie: Towards Improving the Testability of Cloud Application Services, 2012 P Page 9 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Design for Testability (DfT) – Why? Testability § How easy / effective / efficient / expensive is it to test? Can it be tested at all? Increase depth and quality of tests – Reduce cost, effort, time of tests ‡ More bugs detected (earlier) and better root cause analysis with less effort ‡ Support testing of error handling and error conditions, for example to test how a component reacts to corrupted data ‡ Better and more realistic estimation of testing efforts ‡ Testing of non-functional requirements, test automation, regression testing ‡ Cloud testing, testing in production (TiP) Reduce cost, effort, and time for debugging, diagnosis, maintenance ‡ Typically underestimated by managers, not easy to measure honestly Provide building blocks for self-diagnosing / self-correcting software Possible savings ~10% of total development budget (Stefan Jungmayr, http://www.testbarkeit.de/) Simplify, accelerate, and power up the testing Focus the testing on the real stuff … and have more fun in testing … Page 10 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 8. Educate stakeholders on benefit of DfT Design for Testability (DfT) – Who? Joint venture between architects (+ developers) and testers ‡ Collaboration between different stakeholders ‡ Requires accountability and clear ownership Testability must be built-in by architects (+ developers) ‡ Pro-active strategy in tactical design: design the system with testability as a key design criterion ‡ Testers (test automation engineers) must define testability requirements to enable effective and efficient test automation Contractual agreement between design and test Balancing production code and test code ‡ Production code and test code must fit together ‡ Manage the design of production code and test code as codependent assets Page 11 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Educate stakeholders on benefit of DfT Design for Testability (DfT) – How? Suitable testing architecture, good design principles ples Interaction with the system under test through well-defined control points and observation points nts Additional (scriptable) interfaces, ports, hooks, mocks, interceptors for testing purposes (setup, configuration, simulation, recovery) Coding guidelines, naming conventions Internal software quality (architecture, code) Control(lability) Visibility / observability Built-in self-test (BIST), built-in test (BIT) Consistency checks (assertions, design by contract, deviations) Logging and tracing (AOP, counters, monitoring, probing, profiling) Diagnosis and dump utilities, black box (internal states, resource utilization, anomalies at runtime) Think test-first (xTDD): how can I test this? Page 12 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 9. Architectural and design patterns (1) Tester Use layered architectures, reduce number of dependencies Use good design principles ‡ Strong cohesion, loose coupling, separation of concerns SUT Real or simulated environment Component orientation and adapters ease integration testing ‡ Components are the units of testing ‡ Component interface methods are subject to black-box testing Avoid / resolve cyclic dependencies between components ‡ Combine or split components ble ‡ Dependency inversion via callback interface (observer-observable design pattern) Example: MSDN Views Testability guidance The purpose is to provide information about how to increase the testability surface of Web applications using the Model-View-Presenter (M-V-P) pattern. http://msdn.microsoft.com/en-us/library/cc304742.aspx Page 13 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Architectural and design patterns (2) Provide appropriate test hooks and factor your design in a way that lets test code interrogate and control the running system ‡ Isolate and encapsulate dependencies on the external environment ‡ Use patterns like dependency injection, interceptors, introspective ‡ Use configurable factories to retrieve service providers ‡ Declare and pass along parameters instead of hardwire references to service providers ‡ Declare interfaces that can be implemented by test classes ‡ Declare methods as overridable by test methods ‡ Avoid references to literal values ‡ Shorten lengthy methods by making calls to replaceable helper methods Promote repeatable, reproducible behavior ‡ Provide utilities to support deterministic behavior (e.g. use seed values) Æ That’s just good design practice! Page 14 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 10. Design for Testability (DfT) patterns Dependency injection The client provides the depended-on object to the SUT Dependency lookup The SUT asks another object to return the depended-on object before it uses it Humble object We extract the logic into a separate easy-to-test component that is decoupled from its environment Test hook We modify the SUT to behave differently during the test Reference: Gerard Meszaros: xUnit Test Patterns: Refactoring Test Code, Addison-Wesley, 2007 http://xunitpatterns.com/ Page 15 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Use principles and practices from clean code developer (CCD) http://www.clean-code-developer.de/ http://www.clean-code-developer.com/ Page 16 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 11. Interfaces can act as ƒ control points Attributes of testability interfaces ƒ observation points Indirect Input Product API System under Test (SUT) Product Events Test API Dependent Components Indirect Output Test Events ‡ ‡ ‡ ‡ ‡ ‡ ‡ Lightweight vs. intrusive ‡ Manual vs. automatable Realistic vs. artificial ‡ Tester owned vs. developer owned Control-only vs. visibility-only vs. both Information-only vs. knowledge Debug-only (logs / asserts) vs. release build Internal (embedded) vs. external vs. shipping (documented) feature NFR (e.g. security) harmless vs. NFR conflict (e.g. security hole) Page 17 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Logging and tracing Check the architecture and design. Check the dynamic behavior (i.e. communication) of the system. Detect bugs, including sporadic bugs like race conditions. Distributed System ... Event Analyze execution, data flow, and system state. Follow error propagation and reproduce faults. For this, tracing is essential. Tracing is important for unit testing, integration testing, system testing, system monitoring, diagnosis, … ... Event Event Collection Trace visualization Trace Trace analysis Relationship between trace extraction, trace visualization, and trace analysis Start early with a logging and tracing concept! Page 18 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 12. Further benefits of good logging and tracing practices Avoid analysis paralysis – a situation where the test team spends as much time investigating test failures as they do testing Support failure matching and (automated) failure analysis Avoid duplicates in the bug database by using rules of analysis when deciding if a failure has been previously observed Backbone of reliable failure analysis Example: Windows Error Reporting (WER) ‡ Small, well defined set of parameters ‡ Automated classification of issues ‡ Similar crash reports are grouped together ÆReduced amount of data collected from customers: bucketing Page 19 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Diagnosis and dump utilities, black box (internal states, resource utilization, anomalies at runtime) Detect, identify, analyze, isolate, diagnose, and reproduce a bug (location, factors, triggers, constraints, root cause) in different contexts as effective and as efficient as possible ‡ Unit / component testing: bug in my unit/component or external unit/component or environment? ‡ Integration testing of several subsystems: bug in my subsystem or external subsystem or environment? ‡ System of systems testing: bug in which part of the whole system of systems? ‡ Product line testing in product line engineering (PLE): bug in domain engineering part or application engineering part? ‡ Bug in system under test (SUT) or test system? Æ quality of test system is important as well ... ‡ SUT in operation: maintenance, serviceability at the customer site Page 20 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 13. Educate stakeholders on benefit of DfT Strategy for Design for Testability (DfT) over the lifecycle (1) Requ DfT Arch ‡ Consistently defined and well-known in the project to drive a common understanding, awareness, and collaboration with clear accountability ‡ Addressed and specified as one important non-functional requirement from the beginning ‡ Investigated by elicitation techniques (interviews, observation, brainstorming, story writing, prototyping, personas, reuse, apprenticing) ‡ Included and elaborated in the product backlog ‡ Defined, specified, traced, and updated as a risk item in the risk-based testing strategy with well-defined mitigation tasks ‡ Balanced with regards to conflicting non-functional requirements ‡ Implemented dependent on the specific domain, system, and (software) technologies that are available and used Page 21 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Strategy for Design for Testability (DfT) over the lifecycle (2) Requ u Educate stakeholders on benefit of DfT Test Test DfT Arch ‡ Specified and elaborated in a testability guideline for architects, developers, testers (Æ DfT – How?) Æ Testability view*/profile in the architectural design approach ( (ADA) ) ‡ Description how to recognize characteristics of the ADA in an artifact to support an analysis and check of the claimed ADA ‡ A set of controls (controllables) associated with using the ADA ‡ A set of observables associated with using the ADA ‡ A set of testing firewalls within the architecture used for regression testing (firewalls enclose the set of parts that must be retested, they are imaginary boundaries that limits retesting of impacted parts for modified software) ‡ A set of preventive principles (e.g. memory / time partitioning): specific system behavior and properties guaranteed by design (e.g. scheduling, interrupt handling, concurrency, exception handling, error management) ‡ A fault model for the ADA: failures that can occur, failures that cannot occur ‡ Analysis (architecture-based or code-based) corresponding to the fault model to detect ADA-related faults in the system (e.g. model checking) ‡ Tests made redundant or de-prioritized based on fault model and analysis *Additional view to the 4+1 View Model of Software Architecture by Philippe Kruchten Page 22 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved
  • 14. Educate stakeholders on benefit of DfT Strategy for Design for Testability (DfT) over the lifecycle (3) Requ u Test DfT Arch ‡ Included as one important criteria in milestones and quality gates, e.g.: Æ Check control and observation points in the architecture Æ Check testability requirements for sustaining test automation Æ Check logging and tracing concept to provide valuable information Æ Check testability support in coding guidelines Æ Check testability needs (especially visibility) for regression testing ‡ Investigated and explored in static testing: architecture interrogation (interviews, interactive workshops), architecture reviews, QAW, ATAM*, code reviews ‡ Investigated and explored in dynamic testing: special testability tour in scenario testing (application touring) Æ Neglecting testability means increasing technical debt … $$ … *Architecture-centric methods from SEI, see http://www.sei.cmu.edu/ Page 23 November 12, 2013 Corporate Technology Summary – Testability and Design for Testability (DfT) Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved Test Requ u DfT Arch ‡ What? ‡ Why? ‡ Who? ‡ How? Æ Strategy for Design for Testability (DfT) over the lifecycle Page 24 November 12, 2013 Corporate Technology Peter Zimmerer Unrestricted © Siemens AG 2013. All rights reserved