Test Library Architecture Framework

The test library architecture framework is very similar to the test script modularity framework and offers the same advantages, but it divides the application-under-test into procedures and functions instead of scripts. This framework requires the creation of library files (SQABasic libraries, APIs, DLLs, and such) that represent modules, sections, and functions of the application-under-test. These library files are then called directly from the test case script.

To demonstrate the use of this framework we use the same test case as before for test script modularity framework but use an SQABasic library. The library contains a function to perform the operations. Following are the header file (.sbh) and the library source file (.sbl).

'Header File

'Test Library Architecture Framework

"Functions Library


Declare Sub StandardViewFunction BasicLib "Functions Library" (OperandOne As Integer, _ 

 OperandTwo As Interger, _ 

 Operation As String)


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

'Library Source File

'Test Library Architecture Framework

'Functions Library

Sub StandardViewFunction (OperandOne As Integer, _

  OperandTwo As Interger, _

  Operation As String)

  'Click on first operand

 Select Case OperandOne

   Case 0

 PushButton Click, "ObjectIndex=8"

Case 1

 PushButton Click, "ObjectIndex=7"

Case 2

 PushButton Click, "ObjectIndex=11"

Case 3

 PushButton Click, "ObjectIndex=15"

Case 4

 PushButton Click, "ObjectIndex=6"

Case 5

 PushButton Click, "ObjectIndex=10"

Case 6

 PushButton Click, "ObjectIndex=14"

Case 7

 PushButton Click, "ObjectIndex=5"

Case 8

 PushButton Click, "ObjectIndex=9"

Case 9

 PushButton Click, "ObjectIndex=13"

End Select

  'Click on first operand

 Select Case OperandOne

   Case "+"

 PushButton Click, "ObjectIndex=8"

Case "-"

 PushButton Click, "ObjectIndex=7"

Case "*"

 PushButton Click, "ObjectIndex=11"

Case "/"

 PushButton Click, "ObjectIndex=15"

End Select

 'Click on first operand

 Select Case OperandOne

   Case 0

 PushButton Click, "ObjectIndex=8"

Case 0

 PushButton Click, "ObjectIndex=7"

Case 0

 PushButton Click, "ObjectIndex=11"

Case 0

 PushButton Click, "ObjectIndex=15"

Case 0

 PushButton Click, "ObjectIndex=6"

Case 0

 PushButton Click, "ObjectIndex=10"

Case 0

 PushButton Click, "ObjectIndex=14"

Case 0

 PushButton Click, "ObjectIndex=5"

Case 0

 PushButton Click, "ObjectIndex=9"

Case 0

 PushButton Click, "ObjectIndex=13"

End Select

'=

PushButton Click, "ObjectIndex=21"

End Sub


Using this library, the following test case script can be made.


'Test Library Architecture Framework
'Test Case script

'$Include "Functions Library.sbh"

Sub Main

      'Test the Standard View
      Window Set Context, "Caption=Calculator", ""
      
      'Test Add Functionalty
      StandardViewFunction 3,4,"+"
      Result = LabelVP (CompareProperties, "Text=7.", "VP=Add")
      
      'Test Subtract Functionalty
      StandardViewFunction 3,2,"-"
      Result = LabelVP (CompareProperties, "Text=1.", "VP=Sub")
      
      'Test Multiply Functionalty
      StandardViewFunction 4,2,"*"
      Result = LabelVP (CompareProperties, "Text=8.", "VP=Mult")
      
      'Test Divide Functionalty
      StandardViewFunction 10,5,"/"
      Result = LabelVP (CompareProperties, "Text=2.", "VP=Div")
      
End Sub

From this example, you can see that this framework also yields a high degree of modularization and adds to the overall maintainability of the test suite. Just as in test script modularity, if a control gets moved on the Calculator, all you need to change is the library file, and all test cases that call that control are updated.

Make a Free Website with Yola.