Saturday, July 19, 2008

Load the Web Application

Public Function OpenWeb (SampleUrl)
Dim SampleUrl = http://mdvdebugger.blogspot.com
SystemUtil. Run SampleUrl
If (Browser(“title:=Automation Testing, QTP”).Exist(0)) Then
SampleUrl = True
Reporter.reportevent micPass” Page is loaded”
Else
SampleUrl = False
Reporter.reportevent micPass” Page is not loaded”
End if
End Function

Testing Automation Life Cycle


Preparation:
The following activities will be carried out during the preparation.
· Project kick off
· Prepare Execution Plan
· Identify the core team
· Identify key business and division representations
· Core Team will develop processes in coordination with the division representatives.

Design & Development:
The following activities will be carried out during the design of the Test Automation framework.
· Develop Test Automation framework plan
· Set up Infrastructure – Hardware, Software & Tools
· Define the components of the Repository
· Develop the Framework
· Devise a training plan for Divisions about the repository

Implementation:
The implementation activities are
· Implement the project using the test automation framework

Function for RowValid,ObjectExist,ColumnValid and SetTextValue

'Function ObjectExist
Public function ObjectExist ( objExpected )
boolnObjExist = false
if (objExpected.Exist) Then
boolnObjExist = True
End if
IsObjectExist = boolnObjExist
End function

'Function RowValid

Public function RowValid ( objTable, intRowNumber )
boolnRowValid = false
intTblRows = CInt(objTable.GetROProperty("rows"))
intRowNumber = CInt(intRowNumber)
if ((intRowNumber > -1) and (intRowNumber < intTblRows)) Then
boolnRowValid = True
End if
IsRowValid = boolnRowValid
End function

Function ColumnValid
Public function ColumnValid ( objTable, intColumnNumber )
boolnColnValid = false
intTblCols = CInt(objTable.GetROProperty("cols"))
intColumnNumber = CInt(intColumnNumber)

If ((intColumnNumber > -1) and (intColumnNumber < intTblCols)) Then
boolnColnValid = True
End if

IsColumnValid = boolnColnValid
End function

Function SetTextValue
Public function SetTextValue ( objEdit,strData )
boolSuccess = True
on Error Resume Next
objEdit.Object.requestFocus
objEdit.Object.setText strData
objEdit.Object.nextFocus
If Err.Number <> 0 then
Reporter.ReportEvent micFail, "General Java Functions: SetTextValue" , Err.Description
Err.Clear
boolSuccess = false
End if
SetTextValue = boolSuccess
End function

Basic Object Functions

These are very basic functions and can be called on any common standard GUI Object. Commonly used in automation for verifying a value, verifying an object is enabled or disabled, checking whether the object exists and getting value of an object can be classified in to Basic Object function category.

1) VerifyEnabled: To verify an object is enabled.
2) VerifyDisabled: To verify an object is disabled.
3) IsObjectExist: To find out whether the object exists
4) VerifyValue: To verify a expected value
5) GetValue: To get an object value

Function Verify Enabled
Public Function VerifyEnabled (obj)
Dim enable_property
enable_property = obj.GetROProperty("enabled")
If enable_property <> 0 Then
Reporter.ReportEvent micPass, "VerifyEnabled Succeeded", "The test object is enabled"
VerifyEnabled = True
Else
Reporter.ReportEvent micFail, "VerifyEnabled Failed", "The test object is NOT enabled"
VerifyEnabled = False
End If
End Function

Function VerifyDisabled
Public Function VerifyDisabled (obj)
Dim enable_property
enable_property = obj.GetROProperty("disabled")
If enable_property = 0 Then
Reporter.ReportEvent micPass, "VerifyDisabled Succeeded", "The test object is enabled"
VerifyDisabled = True
Else
Reporter.ReportEvent micFail, "VerifyDisabled Failed", "The test object is NOT enabled"
VerifyDisabled = False
End If
End Function

Function Exist Object
Public Function ObjectExist(Obj)
Dim ObjectVisible
ObjectVisible = obj.Exsit
If (ObjectVisible = 0) Then
Reporter.ReportEvent micPass, "Object Visible ", "Succeeded"
ObjectVisible = True
Else
Reporter.ReportEvent micPass, "Object is not Visible ", "Not Succeeded"
ObjectVisible = False
End if
End Function

Automation Approach

The test automation framework provides the function libraries and the skeleton to start automation of an application. As the AUT changes the automation framework also changes. But there are common automation functions that can be applied irrespective of the application under test. In the Generic automation approach the aim is to identify these common functional libraries and utility functions that can be developed once and used for automation of different AUT that may be developed using different programming languages.

The Generic functional libraries can be classified in to
Basic Object Functions: These are the functions that can be called on many different test objects. These functions are common for standard objects.

Language Specific Functions: These are the functions that can be called on the test object specific to AUT development language. There can be a set of functions for each application development language. For Ex: Set of functions for test objects of Java, another set of functions for .NET, VB, etc.

Utility Functions: The utility functions include the string manipulation functions, array manipulation, file handling functions etc. These functions are useful to manipulate input / output data in the test scripts.

Database functions: The database functions are for executing the database queries from the test scripts.

Reporting or Logging functions: The logging functions are helpful for logging any debug / information messages / variable output to either to text file or to a QTP report file. The Reporting functions are to report the results of the test, Pass, Fail, warning and error.