It’s a good day that I complete the QTP-based light-weighted automation testing framework.
Feature:
1. more error handles and the test can continue to execute the next steps or test case even if this step or test case failed
2. The AUT, application and web tools can be appied and tested by this testing framework
3. Better test report. the tester can get the result from excel and QTP report
4. The steps in test case and test data are less coupled. The tester can design the test case more flexibly
5. Each step in the test case is a function. The functions can be available from the common functions library. Also we can write the test script for specified test case. Also more flexible and easier for testcase design.
6. The test script in the framework can run fast even it needs to access the excel files. But the excel files are loaded as the data table, not accessed via the COM interface, so it’s very fast to process.
7. For the web tools, no matter which technology is used like AJAX, GWT or others, can be tested by this framework.
Some sample functions used in the testing:
Sub checkResetWorks()
Set oDesc = Description.Create()
oDesc(“name”).value = “WebEdit”
oDesc(“type”).value = “text”
oDesc(“html tag”).value = “INPUT”
set editCollection = Browser(“GovcorpFeedsOperation”).Page(“GovcorpFeedsOperation”).ChildObjects(oDesc)
NumberOfEdits = editCollection.count
flag = False
For i = 0 To NumberOfEdits – 1
textInEdit = editCollection(i).getROProperty(“value”)
If len(textInEdit)>0 Then
flag = True
Exit For
End If
Next
If (flag=True) Then
Err.raise 101
End If
End Sub
Function inputSearchConditionWithText(Sheet_Name)
flag = -1
label= DataTable(“search_field”, Sheet_Name)
condition= DataTable(“condition”, Sheet_Name)
ops= DataTable(“con_ops”, Sheet_Name)
if Len(ops)<1 then
ops=”=”
End if
rownum= browser(“GovcorpFeedsOperation”).Page(“GovcorpFeedsOperation”).GWTAccordion(“accordion”).WebTable(“webtable”).RowCount
For i = 0 To rownum – 1
textInWebElements = browser(“GovcorpFeedsOperation”).Page(“GovcorpFeedsOperation”).GWTAccordion(“accordion”).WebTable(“webtable”).GetCellData(i,1)
pos = instr(1,textInWebElements,label,1)
‘msgbox “text: “&textInWebElements& ” and pos: “&pos
If pos>0 Then
flag=i-1
Exit For
End If
Next
If flag=-1 Then
Err.raise 101
End If
set oWebEdit=Browser(“GovcorpFeedsOperation”).Page(“GovcorpFeedsOperation”).WebEdit(“type:=text”,”name:=WebEdit”,”html tag:=INPUT”,”index:=”&flag)
set oWebList=Browser(“GovcorpFeedsOperation”).Page(“GovcorpFeedsOperation”).WebList(“name:=select”,”html tag:=SELECT”,”index:=”&flag)
oWebEdit.Set condition
oWebList.Select ops
wait 1
End Function
Function searchByConditionsWithText(Sheet_Name)
flag = False
Call inputSearchConditionWithText(Sheet_Name)
Browser(“GovcorpFeedsOperation”).Page(“GovcorpFeedsOperation”).GWTPushButton(“Submit”).Click
While Browser(“GovcorpFeedsOperation”).Page(“GovcorpFeedsOperation”).WebElement(“ProcessingRequest”).Exist(2)
If Browser(“GovcorpFeedsOperation”).Dialog(“MsgDialog”).Exist(2) then
flag = checkDialogMsg(“severity”)
‘msgbox “One dialog is popped up”
Browser(“GovcorpFeedsOperation”).Dialog(“MsgDialog”).WinButton(“OK”).Click
End if
wait 1
Wend
if (flag=True) then
Err.Raise 101
end if
‘Call oReporterManager.Report(“Pass”,”Step: searchByConditions”,”Search the result by conditions successfully”,”Test Passed”,””)
End Function