Cómo escribir código que sea sea testeable?
Extracto interesante:
"Software testability results from a number of characteristics of the code being tested that the development team should ideally guarantee: Visibility, Control and Simplicity.
The attribute of Visibility is defined as the ability to observe the current state of the software under test and any output it can produce. If testers have a way to programmatically observe a given behavior, then they can easily test it against expected and wrong values. (capacidad de ver que entra y que sale).
The attribute of Control refers to the degree at which the code allows testers to apply fixed input data to the software under test. Any piece of software runs according to a virtual contract that includes preconditions. The easier you can configure preconditions, the easier you can write effective tests.(Capacidad de parametrizar con valores fijos o mockeados)
Simplicity is always a positive attribute for any system and in just every context. Testing is clearly no exception. Simple and extremely cohesive components with are preferable because the less you have to test, the more reliably and quickly you can do that. (Se trata de componentes cohesivos).
In the end, design for software testability means writing the source code—preferably right from the beginning of the project—in order to privilege and maximize attributes such as visibility, control and simplicity. When this happens, writing unit tests that run within testing harnesses is easier and effective"
The attribute of Visibility is defined as the ability to observe the current state of the software under test and any output it can produce. If testers have a way to programmatically observe a given behavior, then they can easily test it against expected and wrong values. (capacidad de ver que entra y que sale).
The attribute of Control refers to the degree at which the code allows testers to apply fixed input data to the software under test. Any piece of software runs according to a virtual contract that includes preconditions. The easier you can configure preconditions, the easier you can write effective tests.(Capacidad de parametrizar con valores fijos o mockeados)
Simplicity is always a positive attribute for any system and in just every context. Testing is clearly no exception. Simple and extremely cohesive components with are preferable because the less you have to test, the more reliably and quickly you can do that. (Se trata de componentes cohesivos).
In the end, design for software testability means writing the source code—preferably right from the beginning of the project—in order to privilege and maximize attributes such as visibility, control and simplicity. When this happens, writing unit tests that run within testing harnesses is easier and effective"
No hay comentarios.:
Publicar un comentario