Wednesday, October 21, 2009

Test Complete 7

Following code Picks Username, Password and Message from an excel file and check it on application CPD:

---------------------------------
Sub Test2


dim efile
dim user
dim pwd
Dim cpd
Dim frmLogin
Dim textBox
Dim msg
dim label

set efile = DDT.ExcelDriver("C:\Documents and Settings\nsharma\My Documents\Test Complete\test1.xls","Sheet2")
'Call Aliases.Explorer.wndCPD.SHELLDLL_DefView.DUIViewWndClassName.DirectUIHWND.CtrlNotifySink.FolderView.Click(82, 129)
Call TestedApps.CPD.Run(1, True)
Set cpd = Aliases.CPD
Set frmLogin = cpd.frmLogin
Set textBox = frmLogin.txtUserName

While Not efile.EOF()

user=efile.Value("user")
pwd=efile.Value("pwd")
msg=efile.Value("msg")

textBox.wText = user
Call textBox.Keys("[Tab]")
frmLogin.txtPassword.wText = pwd
frmLogin.btnOK.ClickButton

label= Aliases.CPD.dlgInterAgencyChildProtectionDatabase.child(2).wndcaption

if label=msg then

efile.Value("Result") = "Pass"


Else

set efile.Value("Result") = "Fail"

End If

cpd.dlgInterAgencyChildProtectionDatabase.btnOK.ClickButton

efile.Next
Wend

' frmLogin.btnCancel.ClickButton
End Sub
-------------------------------------------

No comments:

Post a Comment

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