Test script modularity framework
The test script modularity framework requires the creation of small, independent scripts that represent modules, sections, and functions of the application-under-test. These small scripts are then used in a hierarchical fashion to construct larger tests, realizing a particular test case.
Of all the frameworks this one should be the simplest to grasp and master. It's a well-known programming strategy to build an abstraction layer in front of a component to hide the component from the rest of the application. This insulates the application from modifications in the component and provides modularity in the application design. The test script modularity framework applies this principle of abstraction or encapsulation in order to improve the maintainability and scalability of automated test suites.
To demonstrate the use of this framework,a simple test case for the Windows Calculator program (see Figure 1) to test the basic functions (add, subtract, divide, and multiply).
Figure 1. The Windows Calculator

At the bottom level of the script hierarchy are the individual scripts testing addition, subtraction, multiplication, and division. As examples, the first script that follows tests addition and the second script tests subtraction.
Sub MainWindow Set Context, "Caption=Calculator", ""
'5
PushButton Click, "ObjectIndex=10"
'+
PushButton Click, "ObjectIndex=20"
'6
PushButton Click, "ObjectIndex=14"
'=
PushButton Click, "ObjectIndex=21"
'11
Result = LabelUP (CompareProperties, "Text=11.", "UP=Object Properties")
End Sub
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Sub MainThe two scripts at the next level of the hierarchy would then be used to represent the Standard view and the Scientific view available from the View menu. As the following script for the Standard view illustrates, these scripts would contain calls to the scripts we built previously.Window Set Context, "Caption=Calculator", ""
'20
PushButton Click, "ObjectIndex=11"
PushButton Click, "ObjectIndex=8"
'-
PushButton Click, "ObjectIndex=19"
'10
PushButton Click, "ObjectIndex=7"
PushButton Click, "ObjectIndex=8"
'=
PushButton Click, "ObjectIndex=21"
'10
Result = LabelUP (CompareProperties, "Text=10.", "UP=Object Properties")
End Sub
'Test Script Modularity Framework'Script for Standard View
Sub Main
'Test Add Functionality
CallScript "Test Script Mod Framework - Add
'Test Subtract Functionality
CallScript "Test Script Mod Framework - Substract"
'Test Divide Functionality
CallScript "Test Script Mod Framework - Divide
'Test Multiply Functionality
CallScript "Test Script Mod Framework - Multiply"
End Sub
And finally, the topmost script in the hierarchy would be the test case to test the different views of the application.
'Test Script Modularity Framework'Top level script - represents test case
Sub Main
'Test the Standard View
CallScript "Test Script Mod Framework - Standard"
'Test the Scientific View
CallScript "Test Script Mod Framework - Scientific"
End Sub
From this very simple example you can see how
this framework yields a high degree of modularization and adds to the overall
maintainability of the test suite. If a control gets moved on the Calculator,
all you need to change is the bottom-level script that calls that control, not
all the test cases that test that control.