Download presentation
Presentation is loading. Please wait.
1
Mantas Radzevičius ifm-2/2
Software testability Mantas Radzevičius ifm-2/2
2
Software testability? Huh?
Definition of software testability: The ease with which a computer program can be tested; “Software testability is the degree to which software artifact (i.e. a software system, software module, requirements or design document) supports testing in a given test context” © Wikipedia; “Attributes of software that bear on the effort needed to validate the software product” © ISO.
3
Heuristics of Software testability
Controllability Observability Availability Simplicity Stability Information
4
Controllability The better we can control it, the more testing can be optimized. Software and hardware states and variables can be controlled directly by the test engineer Software modules, objects, or functional layers can be tested independently.
5
Observability What you see is what can be tested.
All factors affecting the output are visible Past system states and variables are visible or queriable System states and variables are visible or queriable during execution
6
Availability To test it, we have to get at it. The system has few bugs
Source code is accessible
7
Simplicity The simpler it is, the less there is to test
The design is self-consistent The feature set is the minimum necessary to meet requirements Modules are cohesive and loosely coupled Code simplicity
8
Stability The fewer the changes, the fewer the disruptions to testing.
Changes to the software are controlled and communicated Changes to the software do not invalidate automated tests
9
Information The more information we have the smarter we will test.
Technology on which the product is based is well understood Dependencies between internal, external and shared components are well understood. The purpose of the software is well understood
10
Short version The software testability can be measured by the level of your headache and curse words per minute. (lower is better)
11
Testability of Requirements
Requirements have to be: Consistent Complete Unambiguous Quantitative Verifiable in practice
12
Why software testability matters?
Poor testability Ineffective/Awkward tests Consequences
13
Why software testability matters?
Economics side: Higher testability -> More better tests -> hopefully less bugs Lower testability -> Less better tests -> bugs++ You (with higher testability): Overall less headaches Smile on your face Good night sleep Effective work
14
Improving software testability
Test driven development: Tests first code later Red-Green-Refactor Automated CI The earlier tests are written the better – encourages testable design
15
Improving software testability (SOLID)
S (SRP) – Single Responsibility Principle “There should never be more than one reason for a class to change” O (OCP) – Open/Closed Principle Software entities should be open for extension but closed for modification L (LSP) – Liskov Substitution Principle “base class must be able to use objects of derived class without knowing it” I (ISP) – Interface Segregation Principle “Clients should not be forced to depend upon interfaces that they do not use” D (DIP) – Dependency Inversion Principle “High level modules should not depend upon low level modules. Both should depend upon abstractions”
16
Law of Demeter Original paper Another explanation
A method of an object should invoke only the methods of the following kinds of objects: Itself Its parameters Any objects it creates/instantiates Its direct component objects Your method can call other methods in its call directly Your method can call methods on its own fields directly When your method takes parameters, your method can call methods on those parameters directly When your method creates local objects, that method can call methods on the local objects
17
Others cool words note to mention
DRY – DON’T REPEAT YOURSELF KISS – KEEP IT SIMPLE STUPID
18
Rule of thumb
19
Read & Learn Robert C. Martin “The Clean Coder”
Martin Fowler “Refactoring: Improving the design of existing code” Robert C. Martin “Clean Code” Find another book to read
20
Got questions??
21
What is software testability? Why is software testability important?
The Questions: What is software testability? Why is software testability important? Name 3 heuristics of software testability? What is SRP? (general idea) (bonus) Basic idea of Law of Demeter? LOD ============================================= Each unit should have only limited knowledge about other units: only units "closely" related to the current unit. Each unit should only talk to its friends; don't talk to strangers. Only talk to your immediate friends.
22
Thank you
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.