On Functional Decomposition
For Test Automation, Functional Decomposition is a test flow analysis and test design technique. And yet somehow it is often confused with structural programming.
Decomposition of Test Flow
Applying Functional Decomposition technique in Test Flow Analysis means splitting (decomposing) a testing scenario into its constituent parts, that are logically complete and data-wise isolated. Some of these parts can be also decomposed in turn, till we have “atomic” elements.
Example
Online banking scenario at the first pass is decomposed into the following elements:
- Login
- Navigation to Banking screen
- Purchase Transaction
- Log off
At the second step, Login sub-scenario is decomposed into atomic elements:
- Input Username
- Input Password
- Press “Login” button
The goal of DEcomposition
The ultimate goal of decomposition is to end up with a minimal set of atomic elements. That means, you eliminate duplicate code. That will be a key to low maintenance cost.
Example
- Wrong: InputUsername, InputPassword
- Right: Input(Username), Input(Password)
The goal of REcomposition
The ultimate goal of recomposition (i.e. design of your tests) is to use only those atomic elements you produced during decomposition, that is, stay within the set you defined. Higher level components you compose must also form a minimalist’s set reusable in other, independent test scenarios.
Example
Login component should be single one of its type. It might include sub-functionalities required in some tests but redundant in others. However, those sub-functionalities must be implemented as isolated components, so that failure or unavailability won’t have an impact on the tests that do not require them.