Hi Ankur,
Please let me know to check for an expected static text in a web page without using the text checkpoint concept.
Currently, I was trying to create a driver script which can drive though the test cases written in excel.Please have a look and let me know for any suggestions/improvements etc.
Here is the script:
Thanks in Advance,
SatyaKiran Watts
Please let me know to check for an expected static text in a web page without using the text checkpoint concept.
Currently, I was trying to create a driver script which can drive though the test cases written in excel.Please have a look and let me know for any suggestions/improvements etc.
Here is the script:
Code:
DataTable.AddSheet "TestCases"
DataTable.AddSheet "OR"
DataTable.AddSheet "StepResults"
DataTable.AddSheet"TestcaseResults"
DataTable.AddSheet"CheckpointResults"
DataTable.GetSheet ("StepResults").AddParameter "TestcaseName",""
DataTable.GetSheet ("StepResults").AddParameter "Result",""
DataTable.GetSheet ("TestcaseResults").AddParameter "TestcaseName",""
DataTable.GetSheet ("TestcaseResults").AddParameter "Result",""
DataTable.GetSheet ("CheckpointResults").AddParameter "TestcaseName",""
DataTable.GetSheet ("CheckpointResults").AddParameter "CheckpointName",""
DataTable.GetSheet ("CheckpointResults").AddParameter "Result",""
Datatable.importSheet "D:\Temp_Official\Satya\Plz dont open FinalFramework\ExcelEngine\TestCases.xls","TestCases","TestCases"
Datatable.importSheet "D:\Temp_Official\Satya\Plz dont open FinalFramework\ExcelEngine\AppMap.xls","OR","OR"
temp=1
j=1
k=1
bool=0
'create_or("E:\Aruna Official\aruna framework\ExcelEngine\AppMap.xls")
'update_testcases("D:\Temp_Official\Satya\Plz dont open FinalFramework\ExcelEngine\TestCases.xls")
Dim BrowserProperty,PageProperty,Object,ObjectProperty,i,x,BrowserName,ObjectName,PageName,z,temprc
temprc= DataTable.GetSheet("TestCases").GetRowCount
For i=1 to temprc Step 1
DataTable.GetSheet("TestCases").SetCurrentRow(i)
If DataTable("TestcaseName","TestCases")<>"" Then
temptc=DataTable("TestcaseName","TestCases")
msgbox "Now about to run the test case :" &temptc
End If
'To place final test case result and exit
If DataTable("BrowserName","TestCases")="" Then
DataTable.GetSheet("TestCases").SetCurrentRow(temp)
DataTable.GetSheet("TestcaseResults").SetCurrentRow(j)
If bool=1 Then
DataTable("TestcaseName","TestcaseResults")=temptc
DataTable("Result","TestcaseResults")="Fail"
bool=0
Else
DataTable("TestcaseName","TestcaseResults")=temptc
DataTable("Result","TestcaseResults")="Pass"
End If
j=j+1
temp=i+1
Exit For
End If
'For Check-Points
Select Case DataTable("Action","TestCases")
Case "check_link"
check_link_save_delete()
Case "check_error"
check_error()
Case "check_login"
check_login()
End Select
'For Object-Identification
Select Case DataTable("Object","TestCases")
set BrowserName=description.create
BrowserName=DataTable("BrowserDescription","OR")
set PageName=description.create
PageName=DataTable("PageDescription","OR")
set ObjectName=description.create
ObjectName=DataTable("ObjectDescription","OR")
Case "WebEdit"
If DataTable("Action","TestCases")="InputText" Then
Browser(BrowserName).Page(PageName).WebEdit(ObjectName).Set DataTable("Value","TestCases")
End If
Case "WebButton"
If DataTable("Action","TestCases")="Click" Then
set BrowserName=description.create
BrowserName("title").value=DataTable("BrowserName","TestCases")
set ObjectName=description.create
ObjectName("value").value=DataTable("ObjectName","TestCases")
set PageName=description.create
PageName("title").value=DataTable("PageName","TestCases")
Browser(BrowserName).Page(PageName).WebButton(ObjectName).Click
End If
Case "WinButton"
If DataTable("Action","TestCases")="Click" Then
set BrowserName=description.create
BrowserName("name").value=DataTable("BrowserName","TestCases")
set ObjectName=description.create
ObjectName("text").value=DataTable("ObjectName","TestCases") 'regexpwndtitle
set PageName=description.create
PageName("text").value=DataTable("PageName","TestCases")
Browser(BrowserName).Dialog(PageName).WinButton(ObjectName).Click 'Type micReturn
End If
Case "ImageButton"
If DataTable("Action","TestCases")="Click" Then
set BrowserName=description.create
BrowserName("title").value=DataTable("BrowserName","TestCases")
set PageName=description.create
PageName("title").value=DataTable("PageName","TestCases")
set ObjectName=description.create
ObjectName("html id").value=".*"&DataTable("ObjectName","TestCases")
Browser(BrowserName).Page(PageName).Image(ObjectName).Click
End If
Case "WebList"
If DataTable("Action","TestCases")="Select" Then
set BrowserName=description.create
BrowserName("title").value=DataTable("BrowserName","TestCases")
set PageName=description.create
PageName("title").value=DataTable("PageName","TestCases")
set ObjectName=description.create
ObjectName("html id").value=".*"&DataTable("ObjectName","TestCases")
Browser(BrowserName).Page(PageName).WebList(ObjectName).Select DataTable("Value","TestCases")
End If
Case "WebLink"
If DataTable("Action","TestCases")="Click" Then
set BrowserName=description.create
BrowserName("title").value=DataTable("BrowserName","TestCases")
set PageName=description.create
PageName("title").value=DataTable("PageName","TestCases")
set ObjectName=description.create
ObjectName("name").value=".*"&DataTable("ObjectName","TestCases")&".*"
Browser(BrowserName).Page(PageName).Link(ObjectName).Click
End If
End Select
'Step wise results
stat=""
Select Case Reporter.RunStatus
Case 0
stat="Pass"
Case 1
bool=1
stat="Fail"
Case 2
stat="Done"
Case 3
stat="Warning"
End Select
DataTable.GetSheet("StepResults").SetCurrentRow(i)
DataTable("TestcaseName","StepResults")=DataTable("TestcaseName","TestCases")
DataTable("Result","StepResults")=stat
'Check point wise results
If mid((DataTable("Action","TestCases")),1,5)="check" Then
DataTable.GetSheet("CheckpointResults").SetCurrentRow(k)
DataTable("TestcaseName","CheckpointResults")=temptc
DataTable("CheckpointName","CheckpointResults")=DataTable("Action","TestCases")
DataTable("Result","CheckpointResults")=stat
k=k+1
End If
'Test case wise results
DataTable.GetSheet("TestCases").SetCurrentRow(i+1)
If DataTable("TestcaseName","TestCases")<>"" Then
DataTable.GetSheet("TestCases").SetCurrentRow(temp)
DataTable.GetSheet("TestcaseResults").SetCurrentRow(j)
If bool=1 Then
DataTable("TestcaseName","TestcaseResults")=temptc
DataTable("Result","TestcaseResults")="Fail"
bool=0
Else
DataTable("TestcaseName","TestcaseResults")=temptc
DataTable("Result","TestcaseResults")="Pass"
End If
j=j+1
temp=i+1
End If
Next
Datatable.ExportSheet "D:\Temp_Official\Satya\Plz dont open FinalFramework\ExcelEngine\Results.xls","StepResults"
Datatable.ExportSheet "D:\Temp_Official\Satya\Plz dont open FinalFramework\ExcelEngine\Results.xls","TestcaseResults"
Datatable.ExportSheet "D:\Temp_Official\Satya\Plz dont open FinalFramework\ExcelEngine\Results.xls","CheckpointResults"
Thanks in Advance,
SatyaKiran Watts