Friday, November 27, 2009

TestComplete: - Programme customization

Sub Test1
Dim cpd
Dim frmCustomizeProgram
Dim panel
Dim textBox
Dim treeView
Dim button
Dim frmCustomizeForms
Dim label
Set cpd = Aliases.CPD
Call cpd.frmCPDMain.StripMainMenu.Click("Tools|Customize Database|Customize Programme")
Set frmCustomizeProgram = cpd.frmCustomizeProgram
frmCustomizeProgram.panel1.pnlTop.btnAddProgram.ClickButton
Set panel = frmCustomizeProgram.panel2
Set textBox = panel.txtProgramName
Call textBox.Click(152, 8)
textBox.wText = "Test Programme"
Call textBox.Keys("[Tab]")
Call panel.txtProgramMetadata.Keys("test description")
frmCustomizeProgram.pnlbottom.btnNext.ClickButton
Set panel = frmCustomizeProgram.panel3
Set treeView = panel.tvForms
j=3
MsgBox("|"+treeview.Nodes.Item(j).Text)
call treeview.ExpandItem("|"+treeview.Nodes.Item(j).Text)
for c=0 to 3
i=random(0,treeview.Nodes.Item(j).Nodes.Count-1)
call treeview.DblClickItem("|" + treeview.Nodes.Item(j).Text+"|" +treeview.Nodes.Item(j).Nodes.Item(i).Text)
aqUtils.Delay(1000)
if (panel.lstVwForms.Items.item(c).text=treeview.Nodes.item(j).Nodes.Item(i).Text) Then
Log.Message("Form selection thru double click Pass")
Else
Log.Message("Form selection thru double click Fail")
end If
Next
' --------------Checking Select button Functionality------------------------------------------
i=random(0,treeview.Nodes.Item(j).Nodes.Count-1)
Call treeview.ClickItem("|" + treeview.Nodes.Item(j).Text+"|" +treeview.Nodes.Item(j).Nodes.Item(i).Text)
Call panel.btnSelect.Click()
if (panel.lstVwForms.Items.item(4).text=treeview.Nodes.item(j).Nodes.Item(i).Text) Then
Log.Message("Form selection thru double click Pass")
Else
Log.Message("Form selection thru double click Fail")
end If
'------------verify result on doublicking already selected form--------------------------------
call treeview.DblClickItem("|" + treeview.Nodes.Item(j).Text+"|" +treeview.Nodes.Item(j).Nodes.Item(i).Text)
if panel.lstVwForms.Items.Count>5 Then
Log.Message("Double Clicking Already Selected Form | Fail")
Else
Log.Message("Double Clicking existing Form| Pass" )
end If
End Sub



function Random(min,max)
Randomize()
Random =Int ((max-min+1)*rnd+min)
end Function


Sub Test2
Dim panel
Set panel = Aliases.CPD.frmCustomizeProgram.panel3
Call panel.tvForms.DblClickItem("|Family Tracing and Reunification|FTR Adult Verification Form")
Call panel.lstVwForms.ClickItem("FTR - Rapid Registration Form", 0)
End Sub

No comments:

Post a Comment

I welcome your comment, will respond and post it at the earliest:)