My Micro Focus UFT\ QTP Blog Collection Lesson 4
---------------------------------------------------
'"Insurance@yahoo.com"
2. My Hp QTP UFT FAQ
---------------------------------------
---------------------------------------------------
My Micro Focus UFT\QTP Learnings, Challenges and Findings
----------------------------------------------------------------------------------------------
Lesson1 :
------------
1
Browser("title:=Google").Page("title:=Google").WebEdit("name:=q","type:=text").Set "google"
2.
Set Desc = Description.Create()
Desc("micclass").Value = "WebEdit"
Set Edits = Browser("Google Sets").Page("Google Sets").ChildObjects(Desc)
MsgBox "Number of Edits: " & Edits.Count
3.
Getting Cell Data From Web Tables and writing to an excel
Purpose:
To the required cell data from a web table and write these values to an excel sheet
Script:
For i=1 to RC
Datatable.GetSheet("MySheet").SetCurrentRow(i)
CC=oTable.ColumnCount(i)
For j=1 to CC
CData=oTable.GetCellData(i,j)
DataTable.GetSheet("MySheet").GetParameter(j).value=CData
Print "CData " & CData
Next
Next
Working Gmail Web Table - Demo
Set oTable=Browser("Gmail: Email from Google").Page("Gmail - Inbox").WebTable(“t") RC=oTable.RowCount
CC=oTable.ColumnCount(1)
Print "RC " & RC
Print "CC " & CC
For i=1 to CC
ColName=oTable.GetCellData(1,i)
Print "ColName "& ColName
DataTable.GetSheet("MySheet").AddParameter ColName,""
Next
For i=1 to RC
Datatable.GetSheet("MySheet").SetCurrentRow(i)
CC=oTable.ColumnCount(i)
For j=1 to CC
CData=oTable.GetCellData(i,j)
DataTable.GetSheet("MySheet").GetParameter(j).value=CData
Print "CData " & CData
Next
Next
--------
My trial code:
Rem VBscript '
String1 = "Coyote" 'water bottle bottlewater waterbottle terbottlewa ttlewaterbo
String2 = "yoteco"
mysrtingcount = len(String1)
for i = 1 to mysrtingcount
RevStr = Mid(String1,i,1)&RevStr
Next
Msgbox RevStr
Revstring3 = strreverse(String1)
msgbox Revstring3
if len(string1) = len(RevStr) then
msgbox "Passs"
Else
msgbox "fail"
End if
---------
Correct code of string rotate:
Rem VBscript '
String1 = "Coyote" 'water bottle bottlewater waterbottle terbottlewa ttlewaterbo
String2= "yoteco" ' reverse "etoyoC"
intlen=round(len(String1)/2)
Msgbox intlen
leftstr=mid(String1,1,intlen)
Msgbox leftstr
rgtstr=mid(String1,intlen+1,len(String1))
Msgbox rgtstr
res=mid(String1,intlen,1)
Msgbox res
For i=1 to len(leftstr) -1
leftres=mid(rgtstr,i,1)
rgtres=mid(leftstr,intlen-i,1)
res=leftres&res&rgtres
Msgbox res
Next
If Len(String1)<>len(res) Then
res=mid(String1,len(String1),1)&res
End If
Msgbox res
print res
'=========================
String1 = "Coyote" 'Coyote yoteco water bottle bottlewater waterbottle terbottlewa ttlewaterbo
For i= 3 to len(String1) Step 2
res1=mid(String1,i,2)
res=res&res1
Msgbox Res
Next
Res2=mid(String1,1,2)
Msgbox Res&Res2
Print Res&Res2
'================================
4.
REM find the highest of n numbers
Option Explicit
Dim Myarr,Great,i
Myarr = array( 22,77,88,99,33)
Great=Myarr(0)
For i=0 to ubound(Myarr)
If Great < Myarr(i) then
Great=Myarr(i)
End If
Next
Msgbox "Highest of provieded N numbers Sample 1 : "&Great
Dim vMyarr(4),vGreat
For i=0 to 4 step 1
vMyarr(i)=cint(Inputbox("Enter the values : "))
Print vMyarr(i)
Next
vGreat=vMyarr(0)
For i= 0 to 4 step 1
If vMyarr(i)>vGreat then
vGreat =vMyarr(i)
End If
Next
Msgbox "Highest of provieded N numbers Sample 2 : "&vGreat
Dim TotalNoOfValues, vGreat1, j, vGetMyarr() TotalNoOfValues=cint(Inputbox("Enter the Total No. Of Values : "))
ReDim vGetMyarr(TotalNoOfValues)
For j=1 to TotalNoOfValues
vGetMyarr(j)=cint(Inputbox("Enter the values : "))
Print vGetMyarr(j)
Next
vGreat1=vGetMyarr(0)
For j =0 to TotalNoOfValues step 1
If vGreat1 < vGetMyarr(j) then
vGreat1=vGetMyarr(j)
End If
Next
Msgbox "Highest of provieded N numbers Sample 3 : "&vGreat1
======================
5.
Rem Arrays
'Sample 1
Dim Rl, Cl
Rl=1
Cl=2
ReDim Lunch(Rl,Cl)
Lunch(0,0)="Apple"
Lunch(0,1)="Graph"
Lunch(0,2)="Orange"
Lunch(1,0)="Pizza"
Lunch(1,1)="Cake"
Lunch(1,2)="Icecream"
For i = 0 To Rl Step 1
For j = 0 To Cl Step 1
Print "This is the end result + "&Lunch(i,j)
Next
Next
'Sample 2
Dim Rc, Cc
Rc=1
Cc=20
ReDim Bread(Rc,Cc-1)
For i = 0 To Rc Step 1
For j = 0 To Cc-1 Step 1
k=k+1
Bread(i,j) = "Here is the Value of two rows claim data "& k
Next
Next
'We get the error message 'Subscript out of range: 'j', due to (i,21) is not assigned above, we have done for cc-1 'Line (628): "Print "This is the end result + "&Bread(i,j)".
'
' For i = 0 To Rc Step 1
' For j = 0 To Cc Step 1
' Print "This is the end result + "&Bread(i,j)
' Next
' Next
For i = 0 To Rc Step 1
For j = 0 To Cc-1 Step 1
Print "This is the end result + "&Bread(i,j)
Next
Next
6.
QTP with JavaApp
'Launch ICE - Active list
Call Launch()
Sub Launch()
Rowc=DataTable.GetRowCount
msgbox rowc
GetRow=DataTable.GetCurrentRow
msgbox GetRow
For i = 1 to Rowc
msgbox Envir
If (Envir="Asys" And GetRow= 1) Then
'msgbox Envir
'msgbox GetRow
'msgbox pass
'SystemUtil.Run "T:\java\centerscripts\Newalauncher.bat"
SystemUtil.Run "P:\java\ice\alauncher.bat"
'msgbox "Exit for1"
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'Center Scripts - Asys
Wait(3)
JavaWindow("Center Scripts").JavaList("Center Code").Select DataTable("Environment", dtGlobalSheet)
Wait(3)
JavaWindow("Center Scripts").JavaList("Application").Select DataTable("Application", dtGlobalSheet)
Wait(3)
JavaWindow("Center Scripts").JavaList("Project").Select DataTable("Project_release", dtGlobalSheet)
Wait(3)
JavaWindow("Center Scripts").JavaEdit("Racf").Set DataTable("Racf_ID", dtGlobalSheet)
Wait(3)
JavaWindow("Center Scripts").JavaButton("Launch").Click
Wait(30)
If Browser("VisaCrd Today Logon").Exist Then
Browser("VisaCrd Today Logon").Close End If
Wait(15)
'Find Account
JavaWindow("iceasys ASYS TEST9").JavaMenu("Account").JavaMenu("Find Account").Select
Wait(2)
JavaWindow("iceasys ASYS TEST9").JavaDialog("Find Account").JavaEdit("Account :").Set DataTable("Required_Account_No", dtGlobalSheet)
JavaWindow("iceasys ASYS TEST9").JavaDialog("Find Account").JavaButton("OK").Click
JavaWindow("iceasys ASYS TEST9").Check CheckPoint("iceasys ASYS TEST9")
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Exit For
Else
If (GetRow >=1) Then
'msgbox "Exit for2"
Exit For
End if
End if
Next
'ExitAction
'msgbox "pass3"
Exit Sub
Lesson2
----------
7.
REM Sample 1 ' Find the greatest of given 3 numbers Option Explicit Dim X,Y,Z
X=Cint(InputBox("Enter the First number : ")) Y=Cint(InputBox("Enter the Second number : ")) Z=Cint(InputBox("Enter the Third number : "))
If X>Y AND X>Z Then
Msgbox X &" is the Greater Number"
End If
If Y>X AND Y>Z Then
Msgbox y &" is the Greater Number"
End If
If Z>X AND Z>Y Then
Msgbox Z &" is the Greater Number"
End If
If X=Y AND Y=Z Then
Msgbox "They all are Equal"
End If
REM Sample 2 ' Find the greatest of given 3 numbers REM Nested if statement 'Option Explicit Dim Xs2,Ys2,Zs2
Xs2=Cint(InputBox("Enter the Smpl2 First number : ")) Ys2=Cint(InputBox("Enter the Smpl2 Second number : ")) Zs2=Cint(InputBox("Enter the Smpl2 Third number : "))
If Xs2>Ys2 AND Xs2>Zs2 Then
Msgbox Xs2 &" is the Greater Number"
ElseIf Ys2>Xs2 AND Ys2>Zs2 Then
Msgbox Ys2 &" is the Greater Number"
ElseIf Zs2>Ys2 AND Zs2>Xs2 Then
Msgbox Zs2 &" is the Greater Number"
Else
Msgbox "They all are Equal"
End If
8.
REM Sample 3 ' Find the greatest of given 3 numbers REM Nested if statement 'Option Explicit 'Dim Xs2,Ys2,Zs2
Xs2=Cint(InputBox("Enter the Smpl2 First number : ")) Ys2=Cint(InputBox("Enter the Smpl2 Second number : ")) Zs2=Cint(InputBox("Enter the Smpl2 Third number : "))
If Xs2>Ys2 AND Xs2>Zs2 Then
Msgbox Xs2 &" is the Greater Number"
ElseIf Ys2>Xs2 AND Ys2>Zs2 Then
Msgbox Ys2 &" is the Greater Number"
Else
Msgbox Zs2 &" is the Greater Number"
End If
9.
' Rem Incrementing the j from 0 to 4 that is for 5 iteration ' and for i number of times.
For i = 0 To 1 Step 1
j=0
If j = 4 Then
j = 0
End If
MsgBox ("j =" & j & " " & "i =" & i)
j=j+1
MsgBox ("j =" & j & " " & "i =" & i)
j=j+1
MsgBox ("j =" & j & " " & "i =" & i)
j=j+1
MsgBox ("j =" & j & " " & "i =" & i)
j=j+1
MsgBox ("j =" & j & " " & "i =" & i)
Next
----
10.
'Rem Sample 1, finding prime no from 1 to 100 Call CmdPrimeNumber ' Functional call Public Function CmdPrimeNumber()
Dim Flag, n, i 'As Integer
Flag=1
Print "Prime Numbers are : "
For n = 1 To 100
For i = 2 To n/2
If n Mod i = 0 Then
Flag = 0
Exit For
Else
Flag=1
End If
Next
If Flag=1 Then
Print n
End If
Next
End Function
'Rem Sample 2, finding prime no from 1 to 100
Flag=1
For i=2 to 100 'primeNo
Flag=1
For j=2 to i/2
If i mod j=0 Then
flag=0
End If
Next
If Flag=1 Then
Print i
End If
Next
'Rem Sample 3
n = cint(Inputbox("Enter a number and check it is a prime number or not")) Count = 0 b = 1 Do while b<=n
If n mod b = 0 Then
Count = Count +1
End If
b=b+1
Loop
If Count = 2 Then
Print "The given number is PRIME number : "&n Else
Print "The given number is normal number : "&n End if
Rem Sample 3, finding the entered or selected no is Prime number Dim N Count = 0 N=Inputbox("Enter a number") For i=2 to N
If N mod i = 0 Then
Count=Count+1
If Count > 3 Then Exit For
End If
Next
If Count>3 Then
Msgbox "The given number "&n& " is a normal number"
Else
Msgbox "The number "&a& " is a prime number"
End If
----
11
'Rem factorial of given Number
F=1
N=Inputbox("Enter a number")
For i=2 to N
F=F*i
Next
Msgbox F
12
'Rem Listing the Even numbers up to the given Number N=Inputbox("Enter a number") For i = 0 to N Step 2 Print "The given number is " &N &" EVEN Numbers are : "&i Next
13
'Rem Listing the Odd numbers up to the given Number N=Inputbox("Enter a number") For i = 1 to N Step 2 Print "The given number is " &N &" ODD Numbers are : "&i Next
-----
Lesson 3
14.
Comparing the List box item.
RelationArray=Split(DataTable("MaMsRelation", dtGlobalSheet),",")
Relin=0
Relincount=SwfObject(amFunc("SwfObject","RelationComboList")).swflist(amFunc("swflist","RelCoList")).Object.items.count
msgbox Relincount
For Rel=0 To Relincount-1
ReDim Preserve RelInArray(Relpin)
RelInArray(Relin)=swflist(amFunc("swflist","RelCoList")).Object.ListBox.items.item(Grp)
print RelInArray(GRelin)
Relin=Relin+1
Next
'Array comparasion for Relation Fields
RelDtlRes=ArrayComp(RelInArray, RelationArray)
If GrpDtlRes=0 Then
CompareValues "Group List Validations = All the array values of Relation match each other", True, True
Else
CompareValues "Group List Validations = All the array values of Relation NOT Matches each other", True,False
End If
15.
LocalSheet replaced with the local specific action sheet.
DataTable.LocalSheet.SetCurrentRow LSChkIRc
Local with Im_Adjudicate_Claim
DataTable.GetSheet("IM_Adjudicate_Claim").SetCurrentRow LSChkIRc
Sample 1 code: ' Commented LocalSheet line of codes (Code as below)
Call ImportSubIdMemId()
Public Function ImportSubIdMemId()
Dim xlApp, xlBook, xlSheet
Dim iRow, sMAMSs_SubscriberID, sMAMSs_MemberID
CONST iMAMS_sle_last_name = 5 'MAMS_sle_last_name is in Column E
CONST iMAMS_sle_first_name = 6 'MAMS_sle_first_name is in Column F
CONST iMAMS_em_date_of_birth = 8 'MAMS_em_date_of_birth is in Column H
CONST iMAMSs_SubscriberID = 11 'MAMSs_SubscriberID is in Column K
CONST iMAMSs_MemberID = 12 'MAMSs_MemberID is in Column L
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.WorkBooks.Open("G:\MAMS_Automation\Action_Scripts\MAMS_CreateNewMemberSubscription\CreateMemberTestdata_Export_OutPutData.xls")
Set xlSheet = xlBook.WorkSheets("MAMS_CreateNewMember")
ClmExtRC = xlSheet.UsedRange.Rows.Count
For iRow = 2 to xlSheet.UsedRange.Rows.Count '''' iRow = 2 because data to be driven & it starts from Row #2
sMAMS_sle_last_name = xlSheet.Rows(iRow).Columns(iMAMS_sle_last_name).Value '''' Retrieve MAMS_sle_last_name and MAMS_sle_first_name from "iRow" rows and columns E & F
sMAMS_sle_first_name = xlSheet.Rows(iRow).Columns(iMAMS_sle_first_name).Value
sMAMS_em_date_of_birth = xlSheet.Rows(iRow).Columns(iMAMS_em_date_of_birth).Value '''' Retrieve MAMS_em_date_of_birt from "iRow" rows and columns H
sMAMSs_SubscriberID = xlSheet.Rows(iRow).Columns(iMAMSs_SubscriberID).Value '''' Retrieve MAMSs_SubscriberID and MAMSs_MemberID from "iRow" rows and columns K & L
sMAMSs_MemberID = xlSheet.Rows(iRow).Columns(iMAMSs_MemberID).Value
Print sMAMS_sle_last_name
Print sMAMS_sle_first_name
Print sMAMS_em_date_of_birth
Print sMAMSs_SubscriberID
Print sMAMSs_MemberID
'VarLsRc = DataTable.LocalSheet.GetRowCount
VarLsRc = DataTable.GetSheet("MAMS_Adjudicate_Claim").GetRowCount
If VarLsRc = ClmExtRC-1 Then
' For LSChkIRc=1 To DataTable.LocalSheet.GetRowCount
' DataTable.LocalSheet.SetCurrentRow LSChkIRc
For LSChkIRc=1 To DataTable.GetSheet("MAMS_Adjudicate_Claim").GetRowCount
DataTable.GetSheet("MAMS_Adjudicate_Claim").SetCurrentRow LSChkIRc
If irow = LSChkIRc+1 Then
' DataTable("MAMSs_SubscriberID", dtLocalSheet)= sMAMSs_SubscriberID
' DataTable("MAMSs_MemberID", dtLocalSheet) = sMAMSs_MemberID
DataTable("MAMS_sle_last_name", "MAMS_Adjudicate_Claim")= sMAMS_sle_last_name
DataTable("MAMS_sle_first_name", "MAMS_Adjudicate_Claim") = sMAMS_sle_first_name
DataTable("MAMS_em_date_of_birth", "MAMS_Adjudicate_Claim")= sMAMS_em_date_of_birth
DataTable("MAMSs_SubscriberID", "MAMS_Adjudicate_Claim")= sMAMSs_SubscriberID
DataTable("MAMSs_MemberID", "MAMS_Adjudicate_Claim") = sMAMSs_MemberID
End If
Next
'DataTable.LocalSheet.SetCurrentRow LSChkIRc
DataTable.GetSheet("MAMS_Adjudicate_Claim").SetCurrentRow LSChkIRc
Else
Print "Both External Subscriber id and Memebrid NOT Match - External : "&ClmExtRC &" Internal : "&VarLsRc
Exit For
End If
Next
xlBook.Close
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Function
For Sample 2 Code : 'Comment "GetSheet("MAMS_Adjudicate_Claim")" and Uncomment the LocalSheet line of codes.
16.
Sample code 16: Map the data with member of Adj claim sheet and manipulate the member id in ClaimNewline sheet base on the number of additional claim.
Call ImportSubIdMemId()
Public Function ImportSubIdMemId()
Dim xlApp, xlBook, xlSheet,iNwln
Dim iRow, sMAMSs_SubscriberID, sMAMSs_MemberID, ClmsMAMSs_MemberID
CONST iMAMS_sle_last_name = 5 'MAMS_sle_last_name is in Column E
CONST iMAMS_sle_first_name = 6 'MAMS_sle_first_name is in Column F
CONST iMAMS_em_date_of_birth = 8 'MAMS_em_date_of_birth is in Column H
CONST iMAMSs_SubscriberID = 11 'MAMSs_SubscriberID is in Column K
CONST iMAMSs_MemberID = 12 'MAMSs_MemberID is in Column L
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.WorkBooks.Open("G:\MAMS_Automation\Action_Scripts\MAMS_CreateNewMemberSubscription\CreateMemberTestdata_Export_OutPutData.xls")
Set xlSheet = xlBook.WorkSheets("MAMS_CreateNewMember")
ClmExtRC = xlSheet.UsedRange.Rows.Count
For iRow = 2 to xlSheet.UsedRange.Rows.Count '''' iRow = 2 because data to be driven & it starts from Row #2
sMAMS_sle_last_name = xlSheet.Rows(iRow).Columns(iMAMS_sle_last_name).Value '''' Retrieve MAMS_sle_last_name and MAMS_sle_first_name from "iRow" rows and columns E & F
sMAMS_sle_first_name = xlSheet.Rows(iRow).Columns(iMAMS_sle_first_name).Value
sMAMS_em_date_of_birth = xlSheet.Rows(iRow).Columns(iMAMS_em_date_of_birth).Value '''' Retrieve MAMS_em_date_of_birt from "iRow" rows and columns H
sMAMSs_SubscriberID = xlSheet.Rows(iRow).Columns(iMAMSs_SubscriberID).Value '''' Retrieve MAMSs_SubscriberID and MAMSs_MemberID from "iRow" rows and columns K & L
sMAMSs_MemberID = xlSheet.Rows(iRow).Columns(iMAMSs_MemberID).Value
Print sMAMS_sle_last_name
Print sMAMS_sle_first_name
Print sMAMS_em_date_of_birth
Print sMAMSs_SubscriberID
Print sMAMSs_MemberID
VarLsRc = DataTable.GetSheet("MAMS_Adjudicate_Claim").GetRowCount
If VarLsRc = ClmExtRC-1 Then
For LSChkIRc=1 To DataTable.GetSheet("MAMS_Adjudicate_Claim").GetRowCount
DataTable.GetSheet("MAMS_Adjudicate_Claim").SetCurrentRow LSChkIRc
If irow = LSChkIRc+1 Then
DataTable("MAMS_sle_last_name", "MAMS_Adjudicate_Claim")= sMAMS_sle_last_name
DataTable("MAMS_sle_first_name", "MAMS_Adjudicate_Claim") = sMAMS_sle_first_name
DataTable("MAMS_em_date_of_birth", "MAMS_Adjudicate_Claim")= sMAMS_em_date_of_birth
DataTable("MAMSs_SubscriberID", "MAMS_Adjudicate_Claim")= sMAMSs_SubscriberID
DataTable("MAMSs_MemberID", "MAMS_Adjudicate_Claim") = sMAMSs_MemberID
End If
Next
DataTable.GetSheet("MAMS_Adjudicate_Claim").SetCurrentRow LSChkIRc
Else
Print "Both External Subscriber id and Memebrid NOT Match - External : "&ClmExtRC &" Internal : "&VarLsRc
Exit For
End If
Next
xlBook.Close
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Function
'ClaimNewLine
Call ClaimNewLineFun()
Public Function ClaimNewLineFun()
iNwln = 1 ' For Claim New Line
VarLsRc1 = DataTable.GetSheet("MAMS_Adjudicate_Claim").GetRowCount
For LSChkIRc1=1 To DataTable.GetSheet("MAMS_Adjudicate_Claim").GetRowCount
DataTable.GetSheet("MAMS_Adjudicate_Claim").SetCurrentRow LSChkIRc1
ClmsMAMSs_MemberID = DataTable("MAMSs_MemberID", "MAMS_Adjudicate_Claim")
NewLineCnt = DataTable("NewLine", "MAMS_Adjudicate_Claim")
' Print NewLineCnt
' Print ClmsMAMSs_MemberID
If NewLineCnt >= 1 Then
For AdjClmRc = 1 To NewLineCnt
DataTable.GetSheet("ClaimNewLine").SetCurrentRow iNwln
Print AdjClmRc
DataTable("MAMSs_MemberID", "ClaimNewLine") = ClmsMAMSs_MemberID
DataTable("ClmNewLine", "ClaimNewLine") = iNwln
If LSChkIRc1 = LSChkIRc1+NewLineCnt Then Exit For
iNwln = iNwln +1
' Print iNwln
' Blabla blabla
Next
DataTable.GetSheet("ClaimNewLine").SetCurrentRow iNwln
End If
Next
DataTable.GetSheet("MAMS_Adjudicate_Claim").SetCurrentRow LSChkIRc1 End Function
17.
Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True
Set objWorkbook1= objExcel.Workbooks.Open("C:\test1.xls")
Set objWorkbook2= objExcel.Workbooks.Open("C:\test2.xls")
Set objRange = objWorkbook1.Worksheets("Sheet1").UsedRange.Copy
objWorkbook2.Worksheets("Sheet1").Range("A1").PasteSpecial objRange
objWorkbook1.Save
objWorkbook1.Close
objWorkbook2.Save
objWorkbook2.Close
'***
18.
Samples code to understand the difference between ByRef and Byvar.
'Sample 1 Byval
'-------------------
Function GetValue( ByVal var1 ) 'Var1 stores the copy of x, it can NOT be Modified.
var1 = var1 + 1
Msgbox var1 ' we can see only the copy of x value only here as well.
End Function
'Pass the variable x to the GetValue function ByVal
Dim x: x = 7
Call GetValue(x) ' Passng the x, simply passing the a copy
MsgBox "Var1 = " & Var1
MsgBox "x = " & x
'Sample 1 ByRef
'-------------------
Function GetReference( ByRef var1 ) 'Var1 becomes the reference of x, it can be Modified.
var1 = var1 + 1
Msgbox var1 ' we can see only the copy of x value only here as well.
End Function
'Pass the variable x to the GetReference function ByRef
Dim x1: x1 = 7
Call GetReference(x1) 'The reference of x & changes made in var1 will change the x value.
MsgBox "Var1 = " & Var1
MsgBox "x1 = " & x1
'Sample 2 ByRef
'-------------------
' Argument is passed by Reference - myname1 can be modified.
Function learnqtp1( ByRef var1)
myname1= "Manick1"
msgbox var1
msgbox myname1
End Function
myname1= "Sundar1"
call learnqtp1 (myname1)
'Sample 2 ByVal
'-------------------
'Argument is passed by Value - - myname1 can NOT be modified.
Function learnqtp( ByVal var)
myname= "Manick12"
msgbox var
msgbox myname
End Function
myname= "Sundar12"
call learnqtp (myname)
'Sample 3 ByRef for Date
'------------------------------
'Pass the variable Mydate1 to the GetDateRef function ByRef Dim Mydate1: Mydate1 = now
Call GetDateRef(Mydate1) 'The reference of Mydate1 & changes made in var1 will change the Mydate1 value.
MsgBox "Var1 = " & Var1
MsgBox "Mydate1 = " & Mydate1
Function GetDateRef( ByRef var1 ) 'Var1 becomes the reference of x, it can be Modified.
var1 = var1 + 1
Msgbox var1 ' we can see only the copy of x value only here as well.
End Function
19.
'Sample 4 ByRef for Date
'------------------------------
'Pass the variable MyJuliDate1 to the CdateToJulianCvrterRef function ByRef Dim MyJuliDate1: MyJuliDate1 = now
MyYear1 = MyJuliDate1
Call CdateToJulianCvrterRef (MyJuliDate1,MyYear1) 'The reference of MyJuliDate1 & changes made in MyDate will change the MyJuliDate1 value.
Print "MyYear1 = " &MyYear1
Print "Mydate1 = " & MyJuliDate1-1
Function CdateToJulianCvrterRef(ByRef MyDate, ByRef MyYear)
'Assigning DateYear to get year number
DateYear = DatePart("yyyy", MyYear)
MyYear = DateYear
Print MyYear
CvrterDateToJulian = MydayFunc(MyDate - DateSerial(Year(MyDate) - 1, 12, 31))
MyDate = CvrterDateToJulian
Print MyDate
'Combining the Gregorian year and Julian day to get JulianDate
JulianDate = DateYear & CvrterDateToJulian
'Display the Gregorian Date to Julian date format
Print "The equivalent Julian date is " & JulianDate
End Function
Function MydayFunc(TheDate)
MydayFunc = Left(TheDate, InStr(TheDate, ".") - 1)
End Function
'---------------------------------------------------------------------------------------------------------------------------------
'***NOTE***: 1. For the call by reference don't use the Public function, Just call by Function only, it works.
' By default its ByRef
'---------------------------------------------------------------------------------------------------------------------------------
20.
Lesson4 :
------------
'Rem this UFT code is to Execute gressionSuiteNov2014.vbs
'REM ExecuteUFTRegressionSuiteNov2014.vbs
Set UFT = CreateObject("QuickTest.Application")
'Launch UFT
UFT.Launch
'Set UFT visible
UFT.Visible = True
'Run Mode - Fast
UFT.Options.Run.RunMode = "Fast"
'View Results - True
UFT.Options.Run.ViewResults = True
'Open the test
UFT.open "H:\Test1", True
' set run settings for the test
Set qtTest = UFT.Test
qtTest.Settings.Run.IterationMode = "rngIterations" ' Run only iterations 2 to 4
qtTest.Settings.Run.StartIteration = 1
qtTest.Settings.Run.EndIteration = 1
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs
'For Viewing Results
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "H:\Test1\Res1" ' Set the results location
qtTest.Run qtResultsOpt ' Run the test
UFT.Options.Run.ViewResults = True
'Set the options to nothing
Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
'Close UFT
UFT.quit ' Close the test
Set UFT = Nothing ' Release the Application object
21.
Call ClaimNewLineFun1()
Public Function ClaimNewLineFun1()
iNwln = 1 ' For Claim New Line
VarLsRc1 = DataTable.GetSheet("MAM_Adjudicate_Claim").GetRowCount
For LSChkIRc1=1 To DataTable.GetSheet("MAM_Adjudicate_Claim").GetRowCount
DataTable.GetSheet("MAM_Adjudicate_Claim").SetCurrentRow LSChkIRc1
' print LSChkIRc1
NewLineCnt = DataTable("NewLine", "MAM_Adjudicate_Claim")
' Print NewLineCnt
If NewLineCnt = 1 Then
For AdjClmRc = 1 To NewLineCnt
DataTable.GetSheet("ClaimNewLine").SetCurrentRow iNwln
' Print AdjClmRc
DataTable("MAMs_MemberID", "ClaimNewLine") = ClmsMAMSs_MemberID
DataTable("ClmNewLine", "ClaimNewLine") = iNwln
If LSChkIRc1 = LSChkIRc1+NewLineCnt Then Exit For
Print LSChkIRc1
Print "Claim Row no : "&LSChkIRc1 &" Claim Newline Row no : "&iNwln
iNwln = iNwln +1
' Blabla blabla
Next
DataTable.GetSheet("ClaimNewLine").SetCurrentRow iNwln
End If
If NewLineCnt > 1 Then
For AdjClmRc = 1 To NewLineCnt
DataTable.GetSheet("ClaimNewLine").SetCurrentRow iNwln
' Print AdjClmRc
DataTable("MAMs_MemberID", "ClaimNewLine") = ClmsMAMSs_MemberID
DataTable("ClmNewLine", "ClaimNewLine") = iNwln
If LSChkIRc1 = LSChkIRc1+NewLineCnt Then Exit For
Print LSChkIRc1
Print "Claim Row no : "&LSChkIRc1 &" Claim Newline Row no : "&iNwln
' Blabla blabla
iNwln = iNwln +1
Next
DataTable.GetSheet("ClaimNewLine").SetCurrentRow iNwln
End If
Next
DataTable.GetSheet("MAM_Adjudicate_Claim").SetCurrentRow LSChkIRc1 End Function
'Rem Test Data
NewLine (Column)
2
6
4
1
Output:
1
Claim Row no : 1 Claim Newline Row no : 1
1
Claim Row no : 1 Claim Newline Row no : 2
2
Claim Row no : 2 Claim Newline Row no : 3
2
Claim Row no : 2 Claim Newline Row no : 4
2
Claim Row no : 2 Claim Newline Row no : 5
2
Claim Row no : 2 Claim Newline Row no : 6
2
Claim Row no : 2 Claim Newline Row no : 7
2
Claim Row no : 2 Claim Newline Row no : 8
3
Claim Row no : 3 Claim Newline Row no : 9
3
Claim Row no : 3 Claim Newline Row no : 10
3
Claim Row no : 3 Claim Newline Row no : 11
3
Claim Row no : 3 Claim Newline Row no : 12
4
Claim Row no : 4 Claim Newline Row no : 13
22.
1. Regular Expression though object repository
Eg 1.Claim No. 201432401201
Text : .*\d{12}
Eg 2. Sle_trans_no for Process&Match
Text : .* (Select Regular expression check box)
2. Descriptive Programming - regular expression
'Getting the DCN & Validating with existing DCN no of the Members.
varDCNExp = DataTable("Executed_DCN","MAM_Adjudicate_Claim")
varDCNAct =PbWindow("w_c_frame").PbWindow("w_adj_claim").PbEdit("ctlnbr").GetROProperty("text")
Set oDesc = Description.Create()
oDesc("text").Value = ".*\d{12}"
oDesc( "pbname" ).value = " clmnbr"
'Validating the Expected DCN and the Actual DCN
CompareValues "DCN Value Validation : ",varDCNExp, varDCNAct
Wait(1)
23.
'Rem SendSMSthroughQTP
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oXMLHTTP = CreateObject("Microsoft.XmlHttp")
sUrl = "http://api.clickatell.com/http/sendmsg"
sAPI_ID = "xxxx"
sPassword = "xxxx"
sUsername = "xxxx"
sMobileNo = "xxxx"
sText = "Message from clickatell.com" ' Assign the SMS text message to this variable
sPostData = "api_id=" & sAPI_ID
sPostData = sPostData & "&user=" & sUsername
sPostData = sPostData & "&password=" & sPassword
sPostData = sPostData & "&to=" & sMobileNo
sPostData = sPostData & "&text=" & sText
oXMLHTTP.Open "POST", sUrl, false
oXMLHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXMLHTTP.Send sPostData
sResult = oXMLHTTP.responseText
Set oXMLHTTP = nothing
Wscript.Echo sResult
Set WshShell = nothing
24.
'Rem Send sms through QTP
SendSMS "8475329433", "This is a test message from learnqtp.info using the free api from http://www.freesmsapi.com"
Function URLEncode (strSMS)
If IsNull(strSMS) then
URLEncode = ""
exit function
End if
URLEncode = strSMS
URLEncode = Replace(URLEncode, chr(0), "")
URLEncode = Replace(URLEncode, "%", "%25")
URLEncode = Replace(URLEncode, " ", "%20")
URLEncode = Replace(URLEncode, """", "%22")
URLEncode = Replace(URLEncode, "&", "%26")
URLEncode = Replace(URLEncode, "'", "%27")
URLEncode = Replace(URLEncode, "/", "%2F")
URLEncode = Replace(URLEncode, "?", "%3F")
URLEncode = Replace(URLEncode, "\", "%5C")
End function
Function SendSMS(strPhone, strSMSMessage)
SMS = URLEncode(strSMSMessage)
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
strURL = "http://s2.freesmsapi.com/messages/send?skey=YOUR-API-KEY&message=" & SMS & "&recipient=" & strPhone
temp = WinHttpReq.Open("POST", strURL, false)
WinHttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
WinHttpReq.Send()
strResult = WinHttpReq.ResponseText
Print strURL
Print strResult
End Function
25.
'http://www.freesmstous.com/
'http://www.afreesms.com/intl/united-states (Asking for verification Code)
'http://www.sendsmsnow.com/
'SundarUSA 'UFTO$SMSO$TestO$123$
option explicit
Dim x, n
'launch way2sms
systemutil.Run("www.way2sms.com")
'login
With browser ("title:=Free SMS.*")
With .page("title:=Free SMS.*")
.webedit("name:=username").set "Mobile Number"
.webedit("name:=password").set "Password"
.webbutton("name:=Login").click
End With
End With
'click send FREE sms
With browser("title:=Free SMS.*")
With .page("title:=Free SMS.*")
.webelement("html tag:=DIV","index:=12").Click
End With
End With
'click send sms
With browser("title:=Free SMS.*")
With .page("title:=Free SMS.*")
.link("html tag:=A","index:=52").Click
End With
End With
'fill fields to send sms
With browser("title:=Free SMS.*")
With .page("title:=Free SMS.*")
.webedit("value:=Mobile Number").Set "Mobile Number "
.webedit("name:=textArea").Set "Message"
.webbutton("name:=Send SMS").Click
End With
End With
'validating sms status
With browser ("title:=Free SMS.*")
With .page("title:=Free SMS.*")
With .frame ("name:=frame")
x=.webelement("html tag:=DIV","index:=9").GetROProperty("innertext")
If trim(x)="Message has been submitted successfully" Then
msgbox("Send SMS test passed")
Else
msgbox("send sms test failed")
End If
End With
End With
end with
Other Method:
Set oMessage = CreateObject("CDO.Message")
oMessage.Subject = "Example CDO Message"
oMessage.Sender = "Insurance@Insurance.com"
oMessage.To = "Insurance@gmail.com"
oMessage.TextBody = "This is some sample message text."
oMessage.AddAttachment "C:\Users\s_m\Desktop\Sample.txt"
oMessage.Send
Set oMessage = Nothing
26.
'Rem Send sms through UFT
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)
' The mailman object is used for sending and receiving email.
set mailman = CreateObject("Chilkat.MailMan2")
' Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial")
If (success <> 1) Then
outFile.WriteLine(mailman.LastErrorText)
WScript.Quit
End If
' Set the SMTP server.
mailman.SmtpHost = "smtp.chilkatsoft.com"
' Set the SMTP login/password (if required)
mailman.SmtpUsername = "myUsername"
mailman.SmtpPassword = "myPassword"
' Create a new email object
set email = CreateObject("Chilkat.Email2")
email.Subject = "Test SMS text message"
email.Body = "This is a test SMS text message"
email.From = "Chilkat Support <support@Insurance.com>"
' Use the 10-digit phone number and SMS gateway domain here:
email.AddTo "John Doe","1234567890@txt.att.net"
' Call SendEmail to connect to the SMTP server and send.
' The connection (i.e. session) to the SMTP server remains
' open so that subsequent SendEmail calls may use the
' same connection.
success = mailman.SendEmail(email)
If (success <> 1) Then
MsgBox mailman.LastErrorText
WScript.Quit
End If
' Some SMTP servers do not actually send the email until
' the connection is closed. In these cases, it is necessary to
' call CloseSmtpConnection for the mail to be sent.
' Most SMTP servers send the email immediately, and it is
' not required to close the connection. We'll close it here
' for the example:
success = mailman.CloseSmtpConnection()
If (success <> 1) Then
MsgBox mailman.LastErrorText
End If
MsgBox "Mail Sent!"
27.
'To send mail from outlook in UFT.
StrBody ="Hi Dear" & vbNewLine & vbNewLine & vbTab &"This is a Test email from UFT to Push Test Results" & vbNewLine & vbNewLine &"Regards," & vbNewLine &"Sundar Manickam," & vbNewLine &"www.Insurance.com<http://www.Insurance.com/, Insurance@yahoo.com"
msgbox strbody
StrBody0 ="Hi Dear" & Chr(13) & Chr(10) & Chr(9) &_
"This is a Test email from UFT to Push Test Results" & Chr(13) & Chr(10) &_
"Regards," & Chr(13) & Chr(10) &_
"Sundar Manickam," & Chr(13) & Chr(10) &_
"www.Insurance.com<http://www.Insurance.com/, Insurance@yahoo.com"
msgbox strbody0
strbody1 = StrBody1 & "Hi Dear," & vbNewLine & vbNewLine
strbody1 = StrBody1 & vbTab & "This is a Test email from UFT to Push Test Results" & vbNewLine
strbody1 = StrBody1 & "Regards," & vbNewLine
strbody1 = StrBody1 & "Sundar Manickam," & vbNewLine
strbody1 = StrBody1 & "www.Insurance.com<http://www.Insurance.com/, Insurance@yahoo.com" & vbNewLine
MsgBox strbody1
'SendEmailToStackholders "Test RUN on UFT", "This is a Test email from UFT to Push Test Results", "Insurance@yahoo.com"
SendEmailToStackholders "Test RUN on UFT", strbody1 , "Insurance@yahoo.com"
'"Insurance@yahoo.com"
Public Function SendEmailToStackholders(ByVal VarSubject, ByVal VarTxtBody, ByVal VaremailIDs)
Set Outlook = CreateObject ("Outlook.Application")
Dim oMessage 'As Outlook.MailItem
Set oMessage = Outlook.CreateItem(olMailItem)
With oMessage
.Subject = VarSubject
.HTMLBody = VarTxtBody
.To = "Insurance@Insurance.com"
.CC = "Insurance@gmail.com"
.BCC = "Insurance@yahoo.com; Sundar@Insurance.com"
.Recipients.Add VaremailIDs
Const olOriginator = 0
.Send
End With
End Function
28.
Public Function ShowPopup(popupmsg)
set popmsg = createobject("wscript.shell")
popupmg = Split(popupmsg,":=")
Getime = Split(popupmg(0)," ")
HBound = UBound(Getime)
If HBound > 0Then
AcTime = HBound/2
Else
AcTime = 1
End If
If UBound(popupmg) > 0 Then
Sec = popupmg(1)
Else
Sec = AcTime
End If
popmsg.popup popupmg(0),Sec,"Scripting Execution ...",64
set popmsg = nothing
End Function
29.
'How to retrieve data from excel to datatable
Set objExcel = createobject("excel.application")
Set objWorkbook = objExcel.WorkBooks.Open("C:\Users\s_manickam\Desktop\Default2.xls")
Set objDriverSheet = objExcel.ActiveWorkbook.Worksheets("ClaimNewLine")
cc = objDriverSheet.usedrange.columns.count
rc = objDriverSheet.usedrange.rows.count
For i = 1 to rc
rname = objDriverSheet.cells(i,1).Value
print rname
If Trim(Ucase(rname)) =Trim(Ucase("30557")) then
For j = 1 to cc
'fieldvalue = fieldvalue & " " & objDriverSheet.cells(i,j)
fieldvalue = objDriverSheet.cells(i,j)
Print fieldvalue
Next
End If
Next
'Save the Workbook
'objExcel.ActiveWorkbook.Save
'Close the Workbook
objExcel.ActiveWorkbook.Close
'Close Excel
objExcel.Application.Quit
Set objDriverSheet =nothing
Set objExcel = nothing
30.
REM '########################################################################################################################################################
REM ''PbDataWindowValidation function is to compare two excel files (or) Validating Generated PbDataWindow with Golden Copy of the PbDataWindow
REM '########################################################################################################################################################
REM 'PbDataWindowValidation "C:\Users\s_manickam\Desktop\PbDtGoldenCopy.xls","C:\Users\s_manickam\Desktop\PbDtGenerated.xls" ,"5","6"
Public Function PbDataWindowValidation(PbdtGoldenCopy,PbdtGenerated,WbShtNoGC,WbShtNoGen)
Reporter.ReportEvent micPass,"Validating Generated PbDataWindow with Golden copy","Comparing Generated PbDataWindow from "&PbdtGenerated&" with golden copy from "&PbdtGoldenCopy
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook1= objExcel.Workbooks.Open(PbdtGoldenCopy) ' Path to Actual golden copy of the PbDataWindow
Set objWorkbook2= objExcel.Workbooks.Open(PbdtGenerated) ' Path to Expected exported PbDataWindow
WbShtNo = Cint(WbShtNo)
Set objWorksheet1= objWorkbook1.Worksheets(WbShtNoGC)
Set objWorksheet2= objWorkbook2.Worksheets(WbShtNoGen)
Dim Actual
Dim Expected
For Each cell In objWorksheet1.UsedRange
Expected=CStr(objWorksheet1.Range(cell.Address).Value)
Actual=CStr(objWorksheet2.Range(cell.Address).Value)
If(CStr(Expected) <> empty ) then 'Allow only non empty cells
If Lcase(CStr(Expected)) <>Lcase(Cstr(Actual)) Then
Reporter.ReportEvent micFail, "PbDataWindow Data : "&cell.Address&" "&Expected,"Expected Value :- "&""""&Expected&""""&chr(13)&" Actual Value :- "&""""&Actual&""""
Else
Reporter.ReportEvent micPass, "PbDataWindow Data : "+Expected,"Expected Value :- "&""""&Expected&""""&chr(13)&" Actual Value :- "&""""&Actual&""""
End if
End If
Next
objWorkbook2.Close
objWorkbook1.Close
objExcel.Quit
Set objExcel=nothing
End Function
32.
VarMAMs_MemberID = 100008
Call CreateGcPbdt()
PbDataWindowValidation "G:\MAM_Automation\Action_Scripts\MAM_Adjudicate_Claim\PbDtGoldenCopy.xls","G:\MAM_Automation\Action_Scripts\MAM_Adjudicate_Claim\PbDtGenerated.xls", "5"
''''How to Retrieve data from "ClaimNewLine" datatable to Excel Sheet for Creating Golden copy.
Public Function CreateGcPbdt()
VarAcLsRcgc = DataTable.GetSheet("ClaimNewLine").GetRowCount
For LSChkIAcRcgc=1 To DataTable.GetSheet("ClaimNewLine").GetRowCount
DataTable.GetSheet("ClaimNewLine").SetCurrentRow LSChkIAcRcgc
If Trim(DataTable("MAMs_MemberID","ClaimNewLine")) =Trim(Ucase(VarMAMs_MemberID)) Then
Call FetchPushPbGcValue(Fldvl0)
PbdtGCRc = PbdtGCRc +1
End If
Next
DataTable.GetSheet("PBdtGC").SetCurrentRow 1
MAM_ExportTestData "G:\MAM_Automation\Action_Scripts\MAM_Adjudicate_Claim\PbDtGoldenCopy.xls"
DataTable.GetSheet("ClaimNewLine").SetCurrentRow LSChkIAcRcgc
End Function
Public Function FetchPushPbGcValue(ByRef Fldvl1)
Fieldvalue1 = DataTable("MAMs_MemberID","ClaimNewLine")
Fieldvalue2 = DataTable("ClmLine_nbr","ClaimNewLine")
Fldvl1 = Fieldvalue2
Fieldvalue3 = DataTable("ClmSvc_date","ClaimNewLine")
Fieldvalue4 = DataTable("ClmBilled_ada_proc","ClaimNewLine")
DataTable.GetSheet("PBdtGC").SetCurrentRow Fieldvalue2 '''' Fldvl0
DataTable("MAMs_MemberID", "PBdtGC") = Fieldvalue1
DataTable("ClmLine_nbr", "PBdtGC") = Fieldvalue2
DataTable("ClmSvc_date", "PBdtGC") = Fieldvalue3
DataTable("ClmBilled_ada_proc","PBdtGC") = Fieldvalue4
End Function
33.
'09-02-14 in QTP. How to convert this
' format to 09-02-2014?
'
'givenDate = "09/02/2014"
givenDate = "09-02-14"
MM= month(givenDate)
msgbox MM
DD = Day(givenDate)
msgbox DD
YY=year(givenDate)
msgbox YY
If MM <= 9 and DD <= 9Then
MM ="0"&MM
DD ="0"&DD
End If
s1ysdate=MM&"/"&DD&"/"&YY
msgbox s1ysdate
34.
' Date converter prefix with zeros using Byref function.
Function GetReferenceDt( ByRef GenDate1 ) 'GenDate1 becomes the reference of GivenDate, it can be Modified.
Print date1 ' we can see only the copy of GivenDate value only here as well.
GenDate1 = CDate(GenDate1)
DD = Day(GenDate1)
If DD <= 9 Then
DD ="0"&DD
End If
MM= Month(GenDate1)
If MM <= 9 Then
MM ="0"&MM
End If
YY= Year(GenDate1)
GenDate1 = MM&"/"&DD&"/"&YY
Print GenDate1
End Function
'Pass the variable GivenDate to the GetReferenceDt function ByRef
Dim GivenDate : GivenDate = "09-02-2014" ''''' "09/02/14"
Call GetReferenceDt(GivenDate) 'The reference of GivenDate & changes made in GenDate1 will change the GivenDate value.
MsgBox "GenDate1 = " & GenDate1
MsgBox "GivenDate = " & GivenDate
35.
Function GetReferenceArr( ByRef arrArray )
ReDim Preserve arrArray(UBound(arrArray)+1)
arrArray(UBound(arrArray)) = 7
End Function
Dim newArray: newArray = Array(0,1,2,3,4,5,6)
Call GetReferenceArr(newArray)
'New Size: 7
MsgBox UBound(newArray)
'New Elements: 0,1,2,3,4,5,6,7
For x = LBound(newArray) To UBound(newArray)
MsgBox newArray(x)
Next
36.
'Sample 1 Byval
'-------------------
Function GetValueMem( ByVal varGivenmem ) 'varGivenmem stores the copy of Givenmem, it can NOT be Modified.
varGivenmem = varGivenmem + 1
Msgbox varGivenmem ' we can see only the copy of Givenmem value only here as well.
End Function
'Pass the variable Givenmem to the GetValue function ByVal
Dim Givenmem : Givenmem = DataTable("MAMs_MemberID", "ClaimNewLine")
Call GetValueMem(Givenmem) ' Passng the Givenmem, simply passing the a copy
MsgBox "varGivenmem = " & varGivenmem
MsgBox "Givenmem = " & Givenmem '30556 as 30556
'Sample 2 ByRef
'-------------------
Function GetRefMem( ByRef varGivenmem ) 'varGivenmem stores the copy of Givenmem, it can be Modified.
varGivenmem = varGivenmem + 1
Msgbox varGivenmem ' we can see only the copy of Givenmem value only here as well.
End Function
'Pass the variable GetRefMem to the GetValue function ByVal
Dim Givenmem1 : Givenmem1 = DataTable("MAMs_MemberID", "ClaimNewLine")
Call GetRefMem(Givenmem1) 'The reference of Givenmem & changes made in varGivenmem will change the Givenmem value.
MsgBox "varGivenmem = " & varGivenmem
MsgBox "Givenmem1 = " & Givenmem1 ' '30556 as 30557
37.
Call ImportSubIdMemId_MII()
' Claim Test Data conversion Method II - Importing the external data to the local sheet.
Public Function ImportSubIdMemId_MII()
'Claim test data conversion of Subscriber id and member id for the selected Last Name, first name and date of birth only.
Dim xlApp, xlBook, xlSheet,iNwln
Dim jRow, sMaMs_SubscriberID, sMaMs_MemberID, ClmsMaMs_MemberID
CONST jMaM_sle_last_name = 5 'MaM_sle_last_name is in Column E
CONST jMaM_sle_first_name = 6 'MaM_sle_first_name is in Column F
CONST jMaM_em_date_of_birth = 8 'MaM_em_date_of_birth is in Column H
CONST jMaMs_SubscriberID = 11 'MaMs_SubscriberID is in Column K
CONST jMaMs_MemberID = 12 'MaMs_MemberID is in Column L
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.WorkBooks.Open("G:\MaM_Automation\Action_Scripts\MaM_CreateNewMemberSubscription\CreateMemberTestdata_Export_OutPutData.xls")
Set xlSheet = xlBook.WorkSheets("MaM_CreateNewMember")
ClmExtRC = xlSheet.UsedRange.Rows.Count
For jRow = 2 to xlSheet.UsedRange.Rows.Count '''' iRow = 2 because data to be driven & it starts from Row #2
sMaM_sle_last_name = xlSheet.Rows(jRow).Columns(jMaM_sle_last_name).Value '''' Retrieve MaM_sle_last_name and MaM_sle_first_name from "iRow" rows and columns E & F
sMaM_sle_first_name = xlSheet.Rows(jRow).Columns(jMaM_sle_first_name).Value
sMaM_em_date_of_birth = xlSheet.Rows(jRow).Columns(jMaM_em_date_of_birth).Value '''' Retrieve MaM_em_date_of_birt from "iRow" rows and columns H
sMaMs_SubscriberID = xlSheet.Rows(jRow).Columns(jMaMs_SubscriberID).Value '''' Retrieve MaMs_SubscriberID and MaMs_MemberID from "iRow" rows and columns K & L
sMaMs_MemberID = xlSheet.Rows(jRow).Columns(jMaMs_MemberID).Value
' Print sMaM_sle_last_name
' Print sMaM_sle_first_name
' Print sMaM_em_date_of_birth
' Print sMaMs_SubscriberID
' Print sMaMs_MemberID
VarLsRc = DataTable.GetSheet("MaM_Adjudicate_Claim").GetRowCount
If VarLsRc > ClmExtRC-1 Then
For LSChkIRc=1 To DataTable.GetSheet("MaM_Adjudicate_Claim").GetRowCount
DataTable.GetSheet("MaM_Adjudicate_Claim").SetCurrentRow LSChkIRc
If Trim(Ucase(DataTable("MaM_sle_last_name", "MaM_Adjudicate_Claim"))) = Trim(Ucase(sMaM_sle_last_name)) and Trim(Ucase(DataTable("MaM_sle_first_name", "MaM_Adjudicate_Claim"))) = Trim(Ucase(sMaM_sle_first_name)) and CDate(DataTable("MaM_em_date_of_birth", "MaM_Adjudicate_Claim")) = CDate(sMaM_em_date_of_birth) Then
DataTable("MaMs_SubscriberID", "MaM_Adjudicate_Claim")= sMaMs_SubscriberID
DataTable("MaMs_MemberID", "MaM_Adjudicate_Claim") = sMaMs_MemberID
End If
Next
DataTable.GetSheet("MaM_Adjudicate_Claim").SetCurrentRow LSChkIRc
Else
Print "Both External Subscriber id and Memeberid NOT Match - External : "&ClmExtRC &" Internal : "&VarLsRc
Exit For
End If
Next
xlBook.Close
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
'The missing Test data hich needs to be updates or Deleted - Please correct the test data.
Dim CheckMem : CheckMem = 0
For LSChkIRc00=1 To DataTable.GetSheet("MaM_Adjudicate_Claim").GetRowCount
DataTable.GetSheet("MaM_Adjudicate_Claim").SetCurrentRow LSChkIRc00
If DataTable("MaMs_SubscriberID", "MaM_Adjudicate_Claim") = "" OR DataTable("MaMs_MemberID", "MaM_Adjudicate_Claim") = "" Then
Print DataTable("MaMs_SubscriberID", "MaM_Adjudicate_Claim")
ShowPopup "Please correct the test data & Do the Claim Process . . . :=4"
Print DataTable("MaMs_MemberID", "MaM_Adjudicate_Claim")
Delete_OR_Update_Row_NO = DataTable.GetSheet("MaM_Adjudicate_Claim").GetCurrentRow
Print "Please update or delete the row number which is NOT Matching - Internaly & Externaly : "&Delete_OR_Update_Row_NO
Print "Both Claim Internal Last Name and Create Member External Last Name is NOT Matching : "&sMaM_sle_last_name
Print "Both Claim Internal First Name and Create Member External First Name is NOT Matching : "&sMaM_sle_first_name
Print "Both Claim Internal Date Of Birth and Create Member External Date Of Birth is NOT Matching : "&sMaM_em_date_of_birth
End If
Next
DataTable.GetSheet("MaM_Adjudicate_Claim").SetCurrentRow LSChkIRc00
End Function
38.
'Nested If statement for mod function of UFT
Dim iNum
iNum = 7
If iNum mod 2 = 0 Then
msgbox iNum mod 2
'Check If number is less than 100 or not
If iNum < 100 Then
msgbox iNum & " is an even number less than 100"
Else
msgbox iNum & " is an even number greater than 100"
End If
Else
msgbox iNum & " is an odd number"
End If
39.
'Select Case
Dim iWeek
iWeek= 10
Select Case iWeek
Case 1
msgbox "Today is Sunday"
Case 2
msgbox "Today is Monday"
Case 3
msgbox "Today is Tuesday"
Case 4
msgbox "Today is Wednesday"
Case 5
msgbox "Today is Thursday"
Case 6
msgbox "Today is Friday"
Case 7
msgbox "Today is Saturday"
Case Else
msgbox "Invalid Number"
End Select
40. ''Retrieve data from "ClaimNewLine" datatable to Excel Sheet for Creating GOLDEN COPY.
Function CreateGcPbdt( ByVal varGivenmem, ByVal varGivenmemCeSq )
'Clearning for the fresh Golden copy for the selected member no. only
AUTIM_ImportTestData "G:\AUTIM_Automation\Action_Scripts\AUTIM_Adjudicate_Claim\GCGENCTemp.xls","GCGENCTempSht","PBdtGC"
VarAcLsRcgc = DataTable.GetSheet("ClaimNewLine").GetRowCount
For LSChkIAcRcgc=1 To DataTable.GetSheet("ClaimNewLine").GetRowCount
DataTable.GetSheet("ClaimNewLine").SetCurrentRow LSChkIAcRcgc
'Print varGivenmem
If Trim(int(DataTable("AUTIMs_MemberID","ClaimNewLine"))) = Trim(int(varGivenmem)) Then
Dim Fldvl0 : Fldvl0 = varGivenmem
Print varGivenmem
If Trim(int(DataTable("AUTIMs_ClaimExe_Sequence","ClaimNewLine"))) = Trim(int(varGivenmemCeSq)) Then
Dim Fldvlceq : Fldvlceq = varGivenmemCeSq
Print varGivenmemCeSq
'Call FetchPushPbGcValue(Fldvl1, Fldvl2)
Call FetchPushPbGcValue(Fldvl0, Fldvlceq)
PbdtGCRc = PbdtGCRc +1
End IF
End If
Next
DataTable.GetSheet("PBdtGC").SetCurrentRow 1
AUTIM_ExportTestData "G:\AUTIM_Automation\Action_Scripts\AUTIM_Adjudicate_Claim\PbDtGoldenCopy.xls"
DataTable.GetSheet("ClaimNewLine").SetCurrentRow LSChkIAcRcgc
End Function
Public Function FetchPushPbGcValue(ByVal Fldvl1, ByVal Fldvl2)
Fieldvalue1 = Fldvl1
Print Fldvl1
Print Fldvl2
Fieldvalue2 = DataTable("ClmLine_nbr","ClaimNewLine")
Fieldvalue3 = DataTable("ClmSvc_date","ClaimNewLine")
Fieldvalue4 = DataTable("ClmBilled_ada_proc","ClaimNewLine")
Fieldvalue5 = DataTable("ClmProc_code","ClaimNewLine")
Fieldvalue6 = DataTable("ClmBilled_tooth_nbr","ClaimNewLine")
Fieldvalue7 = DataTable("Claim_Tooth_Eob","ClaimNewLine")
Fieldvalue8 = DataTable("ClmBilled_tooth_surf","ClaimNewLine")
Fieldvalue9 = DataTable("ClmTooth_surf","ClaimNewLine")
Fieldvalue10 = DataTable("ClmSubChg_amt","ClaimNewLine")
Fieldvalue11 = DataTable("ClmAppr_amt","ClaimNewLine")
Fieldvalue12 = DataTable("ClmAllo_amt","ClaimNewLine")
Fieldvalue13 = DataTable("ClmDed_amt","ClaimNewLine")
Fieldvalue14 = DataTable("ClmPat_amt","ClaimNewLine")
Fieldvalue15 = DataTable("ClmPlan_amt","ClaimNewLine")
Fieldvalue16 = DataTable("ClmPP1","ClaimNewLine")
Fieldvalue17 = DataTable("ClmPP2","ClaimNewLine")
Fieldvalue18 = DataTable("ClmPP3","ClaimNewLine")
Fieldvalue19 = DataTable("ClmPP4","ClaimNewLine")
Fieldvalue20 = DataTable("ClmPP5","ClaimNewLine")
Fieldvalue21 = DataTable("ClmPP6","ClaimNewLine")
DataTable.GetSheet("PBdtGC").SetCurrentRow Fieldvalue2 '''' Fldvl0
DataTable("AUTIMs_MemberID", "PBdtGC") = Fldvl1
DataTable("ClmLine_nbr", "PBdtGC") = Fieldvalue2
DataTable("ClmSvc_date", "PBdtGC") = Fieldvalue3
DataTable("ClmBilled_ada_proc","PBdtGC") = Fieldvalue4
DataTable("ClmProc_code","PBdtGC") = Fieldvalue5
DataTable("ClmBilled_tooth_nbr","PBdtGC") = Fieldvalue6
DataTable("Claim_Tooth_Eob","PBdtGC") = Fieldvalue7
DataTable("ClmBilled_tooth_surf","PBdtGC") = Fieldvalue8
DataTable("ClmTooth_surf","PBdtGC") = Fieldvalue9
DataTable("ClmSubChg_amt","PBdtGC") = Fieldvalue10
DataTable("ClmAppr_amt","PBdtGC") = Fieldvalue11
DataTable("ClmAllo_amt","PBdtGC") = Fieldvalue12
DataTable("ClmDed_amt","PBdtGC") = Fieldvalue13
DataTable("ClmPat_amt","PBdtGC") = Fieldvalue14
DataTable("ClmPlan_amt","PBdtGC") = Fieldvalue15
DataTable("ClmPP1","PBdtGC") = Fieldvalue16
DataTable("ClmPP2","PBdtGC") = Fieldvalue17
DataTable("ClmPP3","PBdtGC") = Fieldvalue18
DataTable("ClmPP4","PBdtGC") = Fieldvalue19
DataTable("ClmPP5","PBdtGC") = Fieldvalue20
DataTable("ClmPP6","PBdtGC") = Fieldvalue21
End Function
41.
1. Regular Expression though object repository
Eg 1.Claim No. 201432401201
Text : .*\d{12}
Eg 2. SleTransNo for Process&Match
Text : .* (Select Regular expression check box)
w_load_ansi_xtn_file - text : Load ANSI FILE (Select Regular expression check box)
42.
Eg.3. Regular Expression though object repository
Text : Total: 12 Records
\Total:\s\d{2}\s\Records\.*
Eg3a.
Text : Total: 141 Records
\Total:\s\d{2}\s\Records\.*
Eg3b.
Text : Total: XXX Records
Text : Total:*.* ( Select Regular expression check box for 12 & 141 or any digits)
43.
VarTotRec = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Total: 12 Records").GetROProperty("text")
Msgbox Left(VarTotRec,8) ===> O/p Total: 1
VarTotRec = Mid(VarTotRec,8,2)
Msgbox VarTotRec ===> O/p 12
VarTotRec = Cint(VarTotRec)/2 ===> O/p 6
Msgbox VarTotRec
44.
1. Regular Expression though object repository
Eg 4. w_lod_ansi_xtn_fls :
Text : Load*.* (Select Regular expression check box for "Load ANSI FILE")
45.
M 1 Dt: 01\ \2015
'‘##############################################################################################################################################################
''# Script Name : AUTIM_ProcessingAndMatching #
''# Script Description : AUTIM Processing And Matching - Functional flow #
'‘# Version Information : AUTIM HIPAA (Version 14.0) #
'‘# Date Created : 08/20/2014 #
'‘# Author : Insurance #
'‘##############################################################################################################################################################
'‘# #
'‘##############################################################################################################################################################
'‘# Pre-Conditions : Processing And Matching #
'‘# Post Conditions : #
'‘# Data Files : Local Data Sheet #
'‘##############################################################################################################################################################
'‘# #
'‘##############################################################################################################################################################
'‘# Global Variables : #
'‘# in Parameters : #
'‘# out Parameters : #
'‘# #
'‘##############################################################################################################################################################
'‘# Revision History #
'‘##############################################################################################################################################################
'‘# Date : 12/18/2014 #
'‘# Details : Updated the UI verification #
'‘# Date : 12/30/2014 #
'‘# Revised By : #
'‘# Details : Updated the Add member Window for entering test data #
'‘##############################################################################################################################################################
''''Processing And Matching
For ChkIRc=1 To DataTable.GlobalSheet.GetRowCount
DataTable.GlobalSheet.SetCurrentRow ChkIRc
''''**** All data table values of Global sheet should typed in UPPERCASE only ***''''
If UCase(Trim(DataTable("AUTIM_Application", dtGlobalSheet))) = "DDIL" And UCase(Trim(DataTable("AUTIM_Execute", dtGlobalSheet))) = "Y" Then
VarLsRc = DataTable.LocalSheet.GetRowCount
For LSChkIRc=1 To DataTable.LocalSheet.GetRowCount
DataTable.LocalSheet.SetCurrentRow LSChkIRc
If LSChkIRc = VarLsRc+1 Then Exit For
ProcessAndMatch() '''' ProcessAndMatch in DDIL
If LSChkIRc = VarLsRc Then
CloseLoadAnsi()
End If
Next
DataTable.LocalSheet.SetCurrentRow LSChkIRc
Else If UCase(Trim(DataTable("AUTIM_Application", dtGlobalSheet))) = "TAIC" And UCase(Trim(DataTable("AUTIM_Execute", dtGlobalSheet))) = "Y" Then
For LSChkIRc=1 To DataTable.LocalSheet.GetRowCount
DataTable.LocalSheet.SetCurrentRow LSChkIRc
ProcessAndMatch() '''' ProcessAndMatch in TAIC
Next
DataTable.LocalSheet.SetCurrentRow LSChkIRc
End If '''' This <End If> of Else If line 47
End if
Next
DataTable.GlobalSheet.SetCurrentRow 1
'''' Wip
Public Function ProcessAndMatch()
CloseLoadAnsi()
Wait(4)
Window("Insurance Test Environment").WinMenu("Menu").Select "Member;Load ANSI Transaction"
'=====================================================================================
'#$ 1. UI Verification for load Ansi File - ' Member Screen $#
'=====================================================================================
''''**** All data table values of Global sheet should typed in UPPERCASE only ****''''
If UCase(Trim(DataTable("AUTIM_Application", dtGlobalSheet))) = "DDIL" and UCase(Trim(DataTable("AUTIM_UI_Verifications", dtGlobalSheet))) = "Y" Then
Wait(4)
'''' Update the UI Verification from the actual UI Verification as "AUTIM_ProcessAndMatchAnsiFile_UIVerificationData.xls"
Verification "w_cre_frame,w_load_ansi_xtn_file","PandMAnsiFile_UIVerify"
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").Activate
'''' UFT Bitmap check point resolution dependent.
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").Check CheckPoint("w_load_ansi_xtn_file")
End If
Wait(4)
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").Maximize
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbRadioButton("EUTF Live").Set
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbEdit("sle_trans_no").Set DataTable("AUTIMs_sle_trans_no", "AUTIM_ProcessAndMatchAnsiFile") '''' "164229"
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Run").Click
If PbWindow("w_cre_frame").Dialog("System Error").Exist(4) Then
PbWindow("w_cre_frame").Dialog("System Error").WinButton("OK").Click
End If
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbTabStrip("tab_1").Select 2
Dim GivenTrnNoGenC : GivenTrnNoGenC = DataTable("AUTIMs_sle_trans_no", "AUTIM_ProcessAndMatchAnsiFile")
'=============================================================================================================
'#$ ' This FetchTans Function is to Validate the PAM by fetching and generating Validation data $#
'=============================================================================================================
Call FetchTans(GivenTrnNoGenC) '''' Passing the GivenTrnNoGenC, simply passing the a copy
Wait(1)
'----
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData "#1","ignore","ON"
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Identify").Click
' PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData "#1","create_new_person","ON"
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Process").Click
' ShowPopup "Please wait the Claim Test data of Processing and Matching is in Process . . . :=4"
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData "#1","accept_pat_pers_nbr","OFF"
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData "#1","accept_pat_pers_nbr","ON"
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Identify").Click
' PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Process").Click
' PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'----
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").Minimize
End Function
Public Function CloseLoadAnsi()
'''' load Ansi file - Processing ANSI Transaction file
If PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Close").Exist(4) Then
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").Maximize
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Close").Click
'SendHotKeys "%C"
End If
If PbWindow("w_cre_frame").Dialog("AUTIM").Exist(4) Then
PbWindow("w_cre_frame").Dialog("AUTIM").WinButton("Yes").Click
End If
End Function
Function FetchTans(ByVal varGivenTrnNoGenC)
'''' Fetching the Transation data for the given AUTIMs_Sel_trans_no
'''' Clearning for the fresh Generated copy for the selected Transation numbers only
AUTIM_ImportTestData "G:\AUTIM_Automation\Action_Scripts\AUTIM_ProcessingAndMatching\GCGENCTempPAM.xls","GCGENCTempShtPAM","PbdtGenCpyPAM"
VarTotRec = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Total: 12 Records").GetROProperty("text")
VarTotRec = Mid(VarTotRec,8,2)
VarTotRec = Cint(VarTotRec)
Print "Total: <<< " &VarTotRec &" >>> Records"
DataTable("PAM_Tot_Rec", "AUTIM_ProcessAndMatchAnsiFile") = VarTotRec
For iTRc = 1 To VarTotRec Step 1
DataTable.GetSheet("PbdtGenCpyPAM").SetCurrentRow iTRc
DataTable("PAM_Tot_Rec", "PbdtGenCpyPAM") = iTRc
DataTable("AUTIMs_sle_trans_no", "PbdtGenCpyPAM") = varGivenTrnNoGenC
Next
DataTable.GetSheet("PbdtGenCpyPAM").SetCurrentRow 1
'''' Rc is the row count of PAM's Transcations in Transcations local sheet.
Dim Rc, Cc,j
Rc=PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").RowCount
Print Rc
Cc=PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").ColumnCount
Print Cc
Cc=19
ReDim PAMTrnNoLnNbr(Rc-1,Cc-1)
ShowPopup "Please wait it is doing the PAM's Transcations Validation :=10"
For i = 0 To Rc-1 Step 1
j = 0
If j = 17 Then
j = 0
End If
DataTable.GetSheet("PbdtGenCpyPAM").SetCurrentRow i+1
'Print varGivenTrnNoGenC
varTrnNoExp = varGivenTrnNoGenC
varTrnNoAct = DataTable("AUTIMs_sle_trans_no", "PbdtGenCpyPAM")
'''' Validating the Expected TrnNo and the Actual TrnNo
CompareValues "TrnNo Value Validation",varTrnNoExp, varTrnNoAct
Wait(1)
If varTrnNoExp = varTrnNoAct Then
DataTable("AUTIMs_sle_trans_no", "PbdtGenCpyPAM") = " "
'Print "This is the Empty TranNo + "&DataTable("AUTIMs_sle_trans_no", "PbdtGenCpyPAM")
ShowPopup "Please wait .... :=02"
DataTable("AUTIMs_sle_trans_no", "PbdtGenCpyPAM") = varGivenTrnNoGenC
'Print DataTable("AUTIMs_sle_trans_no", "PbdtGenCpyPAM")
ShowPopup "Please wait .... :=02"
End If
Wait(1)
'Print DataTable("AUTIMs_sle_trans_no", "PbdtGenCpyPAM")
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"trans_type") '''' Transcation Type
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_trans_type", "PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
VarTypA = DataTable("PAM_trans_type", "PbdtGenCpyPAM")
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"trans_reason") '''' Transcation Reason
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_trans_reason","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"eff_date") '''' Effective Date
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_eff_date", "PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"acct_nbr") '''' Account Number
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_acct_nbr","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"grp_nbr") '''' Group Number
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_grp_nbr","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"div_nbr") '''' Division Number
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_div_nbr","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"current_sub_ssn") '''' Current Subscriber SSN Number
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_current_sub_ssn","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"current_mbr_ssn") '''' Current Member SSN Number
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_current_mbr_ssn","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"fullname") '''' Full Name Subscriber
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_fullname","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"rel_code") '''' Rel Code of Subscriber
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_rel_code","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"current_dob") '''' Current Date of Birth
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_current_dob","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
''''' Fetching the Subscribered Person Number
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"sub_pers_nbr") '''' Subscribered Person Number
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_sub_pers_nbr","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
VarSubPersNbr = DataTable("PAM_sub_pers_nbr", "PbdtGenCpyPAM")
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"pat_pers_nbr") '''' Subscribered Patient Number
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_pat_pers_nbr","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
VarPatPersNbr = DataTable("PAM_pat_pers_nbr", "PbdtGenCpyPAM")
'''' Selecting only the Variable type of "A" for Accepted patinet number where;
'''' the Subscribered Person Number and the Subscribered Patient Number is Empty.
If UCase(VarTypA) = "A" And VarSubPersNbr = "" And VarPatPersNbr = "" Then
j=j+1
'''' Create Accepted Patient Number Check box Selection
PAMTrnNoLnNbrChk = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"accept_pat_pers_nbr") '''' Accepted Patient Number
Print "This is the end result + "&PAMTrnNoLnNbrChk
If PAMTrnNoLnNbrChk = "ON" Then
Wait(1)
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").ActivateCell i+1,"accept_pat_pers_nbr"
Wait(1)
'''' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData i+1,"accept_pat_pers_nbr","OFF"
'''' DataTable("PAM_accept_pat_pers_nbr","PbdtGenCpyPAM") = "OFF"
DataTable("PAM_accept_pat_pers_nbr","PbdtGenCpyPAM") = "ON"
Print "This is the end result + "&DataTable("PAM_accept_pat_pers_nbr","PbdtGenCpyPAM")
ElseIf PAMTrnNoLnNbrChk = "OFF" OR PAMTrnNoLnNbrChk = "" Then
Wait(1)
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").ActivateCell i+1,"accept_pat_pers_nbr"
Wait(1)
PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData i+1,"accept_pat_pers_nbr","ON"
DataTable("PAM_accept_pat_pers_nbr","PbdtGenCpyPAM") = "ON"
Print "This is the end result + "&DataTable("PAM_accept_pat_pers_nbr","PbdtGenCpyPAM")
End If
' j=j+1
' '''' Create New Person Check box Selection
' PAMTrnNoLnNbrChk = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"create_new_person") '''' Create New Person
' Print "This is the end result + "&PAMTrnNoLnNbrChk
'
' If PAMTrnNoLnNbrChk = "ON" Then
'
' Wait(1)
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").ActivateCell i+1,"create_new_person"
'
' Wait(1)
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData i+1,"create_new_person","OFF"
' DataTable("PAM_create_new_person","PbdtGenCpyPAM") = "OFF"
' Print "This is the end result + "&DataTable("PAM_create_new_person","PbdtGenCpyPAM")
'
' ElseIf PAMTrnNoLnNbrChk = "OFF" OR PAMTrnNoLnNbrChk = "" Then
'
' Wait(1)
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").ActivateCell i+1,"create_new_person"
'
' Wait(1)
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData i+1,"create_new_person","ON"
' DataTable("PAM_create_new_person","PbdtGenCpyPAM") = "ON"
' Print "This is the end result + "&DataTable("PAM_create_new_person","PbdtGenCpyPAM")
'
' End If
'
'
' j=j+1
' '''' Create Ignore Check box Selection
' PAMTrnNoLnNbrChk = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"ignore") '''' Ignore
' Print "This is the end result + "&PAMTrnNoLnNbrChk
'
' If PAMTrnNoLnNbrChk = "ON" Then
'
' Wait(1)
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").ActivateCell i+1,"ignore"
'
' Wait(1)
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData i+1,"ignore","OFF"
' DataTable("PAM_ignore","PbdtGenCpyPAM") = "OFF"
' Print "This is the end result + "&DataTable("PAM_ignore","PbdtGenCpyPAM")
'
' ElseIf PAMTrnNoLnNbrChk = "OFF" OR PAMTrnNoLnNbrChk = "" Then
'
' Wait(1)
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").ActivateCell i+1,"ignore"
'
' Wait(1)
'
' PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData i+1,"ignore","ON"
' DataTable("PAM_ignore","PbdtGenCpyPAM") = "ON"
' Print "This is the end result + "&DataTable("PAM_ignore","PbdtGenCpyPAM")
'
' End If
End If
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"processed") '''' Processed
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_processed","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
j=j+1
PAMTrnNoLnNbr(i,j) = PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").GetCellData(i+1,"error_message") '''' Error Message
'Print "This is the end result + "&PAMTrnNoLnNbr(i,j)
DataTable("PAM_error_message","PbdtGenCpyPAM") = PAMTrnNoLnNbr(i,j)
Next
DataTable.GetSheet("PbdtGenCpyPAM").SetCurrentRow 1
AUTIM_ExportTestData "G:\AUTIM_Automation\Action_Scripts\AUTIM_ProcessingAndMatching\PbDtGeneratedPAM.xls"
End Function
'Window("Insurance Test Environment").WinMenu("Menu").Select "Member;Load ANSI Transaction"
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbRadioButton("HPE").Set
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").WinObject("PROCESS ANSI TRANSACTION").Click 113,53
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbRadioButton("EUTF Live").Set
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbEdit("sle_trans_no").Set "164229"
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Run").Click
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SelectCell "#3","trans_type"
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData "#3","ignore","ON"
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Identify").Click
'PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData "#1","create_new_person","ON"
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbDataWindow("dw_transaction").SetCellData "#2","create_new_person","ON"
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Process").Click
'PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Identify").Click
'PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbButton("Process").Click
'PbWindow("w_cre_frame").Dialog("Confirmation").WinButton("Yes").Click
'Window("Window").Click 679,130
'Window("Window").Click 606,147
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").PbTabStrip("tab_1").Select 2
'PbWindow("w_cre_frame").PbWindow("w_load_ansi_xtn_file").Maximize
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
' ************************************************** $
'''''$$$$****$$$$****$$$$****$$$$**** / End of the Code AUTIM_ProcessingAndMatching / ****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$****$$$$
' ************************************************* $
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
46.
ByRef for array example code 1 .
ReDim arrMultiGroc(2,13)
arrMultiGroc(0,0) = "Maanikam"
MsgBox arrMultiGroc(0,0)
arrMultiGroc(2,0) = "Sundar"
MsgBox arrMultiGroc(2,0)
Call GetReference(arrMultiGroc)
Function GetReference( ByRef arrArray )
ReDim Preserve arrArray(2,13)
arrArray(2,1) = "Orange"
MsgBox arrArray(2,1)
MsgBox arrMultiGroc(2,0)
End Function
47.
ByRef for array example code 2 .
Rc=21
Cc=18
ReDim arrMultiGroc(Rc-1,Cc-1)
For i = 0 To Rc-1 Step 1
For j = 0 To Cc-1 Step 1
If i = 0 and j = 0 Then
arrMultiGroc(0,0) = "Maanikam" ''''arrMultiGroc(0,0) = "Maanikam"
MsgBox arrMultiGroc(i,j) '''' MsgBox arrMultiGroc(0,0)
End If
If i = 2 and j = 0 Then
arrMultiGroc(i,j) = "Sundar" ''''arrMultiGroc(2,0) = "Sundar"
MsgBox arrMultiGroc(i,j) ''''MsgBox arrMultiGroc(2,0)
End If
VariGiven = i
VarjGiven = j
Call GetReference(arrMultiGroc, VariGiven, VarjGiven, VarTypAGiven)
Next
Next
Function GetReference( ByRef arrArray, ByVal Vari, ByVal Varj,VarTypA)
ReDim Preserve arrArray(Rc-1,Cc-1)
If i = 0 and j = 14 Then
arrArray(i,j) = "ON - Acceept pat per no"
MsgBox arrArray(i,j)
End If
If i = 0 and j = 15 Then
arrArray(0,15) = "OFF - Create New pat per"
MsgBox arrArray(0,15)
End If
If i = 0 and j = 16 Then
arrArray(0,16) = "ON - Ignore"
MsgBox arrArray(0,16)
End If
If i = 2 and j = 1 Then
arrArray(2,1) = "Orange"
MsgBox arrArray(2,1)
End If
If i = 7 and j = 7 Then
arrArray(i,j) = "7 of 7 Mcsm Apple"
MsgBox arrArray(i,j)
End If
If i = 7 and j = 8 Then
arrArray(i,j) = "7 of 8 Mc Cherry"
MsgBox arrArray(i,j)
End If
If i = 3 and j = 5 Then
arrArray(i,j) = "3 of 5 Mam Jack"
MsgBox arrArray(i,j)
End If
If i = 20 and j = 18-1 Then
arrArray(i,j) = "21 Plus 18 Orange"
MsgBox arrArray(i,j)
End If
If i = 2 and j = 0 Then
MsgBox arrMultiGroc(2,0)
End If
End Function
48.
Eg1 Find em_subscriber_ssn
Text : .* (Select Regular expression check box)
em_subscriber_ssn- text : Load ANSI FILE (Select Regular expression check box)
Eg2 Find em_ sle_last_name_ssn
Text : .* (Select Regular expression check box)
sle_last_name- text : Load ANSI FILE (Select Regular expression check box)
---------------------------------------
1) Which environments are
supported by QTP?
QTP supports the following
environments
To learn more about Add-ins and how
to use them, watch this video tutorial.
|
2) What are the types object
Repositories in QTP.
QTP Supports 2 types of Object
Repository
1) Shared Object Repository
(also called Global)
2) Per-Action Object Repository, (also called Local)
Per-Action Object Repository is used by
default. The extension for Per-Action repository is ".mtr"
.
Shared Object Repository is preferable
while dealing with dynamic objects which are called in multiple
tests. The extension is ".tsr"
3) Can we call QTP test from another
test using scripting. Suppose there are 4 tests and I want to call
these tests in a main script. Is this possible in QTP?
Yes. You can call 4 or
even more scripts in your tests.For this, first you will need to make
the Actions in the corresponding scripts re-usable.Then from
the destination script you can make calls to these re-usable actions.
4) What is action split and the
purpose of using this in QTP?
Action split is to divide an existing
action into two parts.The purpose is to divide actions based on their
functionality to improve code re-use.
5) How will you handle Java tree in
QTP ?
Foremost you will select Java Add -
In and launch QTP. Next step record operations on the Java Tree.
If you face an issue while recording, you can select Tools >
Object Identification > Java, tree object and make changes in
mandatory and assistive properties to enable identification.
Tip: You can base you answer on
similar lines for any other object of any environment. For example :
If the question is how will check SAP checkbox , You say , first I
will select SAP Add in ... and so on.
6) Explain how QTP identifies object
?
QTP identifies any GUI Object based on
its corresponding properties. While recording, QTP will
identify and store peculiar properties (as defined in the Object
Identification settings) in the object repository of the GUI object .
At run-time, QTP will compare the stored property values with the
on-screen properties, to uniquely identify the GUI object.
Learn more about Object
Identification
7) How many types of recording modes
in QTP? Which will be used when ?
QTP supports 3 types of recording
modes
1. Normal mode also called
Contextual
2. Low-level recording mode
3.Analog mode
Normal Mode: It is the default
recording mode and takes full advantage of QTP's Test Object Model.
It recognizes objects regardless of their position on -screen.
This is the preferred mode of recoding and is used for most of the
automation activities.
Low-level recording mode:
This mode records the exact x,y co-ordinates of your mouse
operations. It is helpful in testing hashmaps. It is useful for
recording objects not identified by normal mode of QTP.
Analog mode: This mode
records exact mouse and keyboard "movements" you
perform in relation to the screen / application window. This mode is
useful for the operation such as drawing a picture, recording
signature., drag and drop operations.
Learn more about Recording
Modes in QTP
8) How will you call from one
action to another action ?
We can call an action in 2 ways
1) Call to copy of Action. - In
this ,the Action Object Repository , Script and Datable will be
copied to the destination Test Script.
2) Call to Existing Action. - In this, Object Repository , Script and Datable will NOT be copied but a call (reference) would be made to the Action in the source script.
2) Call to Existing Action. - In this, Object Repository , Script and Datable will NOT be copied but a call (reference) would be made to the Action in the source script.
9) What are Virtual Objects?
Your application may contain objects
that behave like standard objects but are not recognized by QTP.
You can define these objects as virtual objects and map them to
standard classes, such as a button or a check box. QTP emulates
the user's action on the virtual object during the run session. In
the test results, the virtual object is displayed as though it is a
standard class object.
For example, suppose you want to record
a test on a Web page containing a bitmap that the user clicks. The
bitmap contains several different hyperlink areas, and each area
opens a different destination page. When you record a test, the Web
site matches the coordinates of the click on the bitmap and opens the
destination page.
To enable QTP to click at the required
coordinates during a run session, you can define a virtual object for
an area of the bitmap, which includes those coordinates, and map it
to the button class. When you run a test, QTP clicks the bitmap in
the area defined as a virtual object so that the Web site opens the
correct destination page.
10) How to perform Cross platform
testing and Cross browser testing using QTP? Can u explain giving
some example?
You will need to create separate
Actions which take care of different OS and Browsers
Cross Platform Testing:
Using the Built in Environment Variable you can dig up the OS information.
Using the Built in Environment Variable you can dig up the OS information.
Eg. Platform = Environment("OS").
Then based on the Platform you need to call the actions which you
recorded on that particular platform.
Cross Browser Testing:
Using this code Eg. Browser("Core Values").GetROProperty("version") you can extract the Browser and its correspondin version. Ex: Internet Explorer 6 or Netscape 5. Based on this value you call the actions which are relevant to that browser.
Cross Browser Testing:
Using this code Eg. Browser("Core Values").GetROProperty("version") you can extract the Browser and its correspondin version. Ex: Internet Explorer 6 or Netscape 5. Based on this value you call the actions which are relevant to that browser.
11) What is logical name of the
object?
Logical name is a name given
by QTP while creating an object in the repository to
uniquely identify it from other objects in the application. This name
would be used by the QTP to map the object name in script with its
corresponding description in the object repository. Ex:
Browser("Browser").Page("Guru99") Here Guru99 is
the logical name of the object.
12) What is descriptive programming?
Typically ,an object and its properties
must be recorded in the Object Repository to enable QTP to perform
action s on it.
Using descriptive programming , you
do not store the object and its property values in the Object
repository but mention the property value pair directly in
the script.
The idea behind descriptive programming
is not bypass the object repository but help recogonize dynamic
objects.
Learn more about Descriptive
Programming
13)What are the properties you would
use for identifying a browser & page when using descriptive
programming ?
You can use the name property
ex:
Browser("name:="xxx"").page("name:="xxxx"").....
OR
We can also use the property "micClass".
ex: Browser("micClass:=browser").page("micClass:=page")....
We can also use the property "micClass".
ex: Browser("micClass:=browser").page("micClass:=page")....
14)Can we record an application
running on a remote machine using QTP ?
Yes .you can record remote
application provided you are accessing application through the local
browser not via remoter like citrix.
If you are still unable to record it is
advisable install QTP and application, on the same machine
15) Explain the keyword CreateObject
with an example.
Creates and returns a reference to an
Automation object
SYNTAX:
CreateObject(servername.typename [, location])
Arguments
servername: Required. The name of the application providing the object.
typename : Required. The type or class of the object to create.
location : Optional. The name of the network server where the object is to be created.
servername: Required. The name of the application providing the object.
typename : Required. The type or class of the object to create.
location : Optional. The name of the network server where the object is to be created.
Example : Set IE =
CreateObject("InternetExplorer.Application")
16) Can you switch between
Per-Action and Shared Object Repository ? If yes how ?
Yes .We can switch. Go to
Test--->Settings--->Resources. Here you have an option to
choose repositories.
17) What is Object Spy ? How to Use
it ?
Object Spy helps in determining the
run & test time object properties & methods of the
application under test.
You can access object spy directly from
the toolbar or from the Object Repository Dialog Box.
It is very useful during Descriptive
Programming
Learn more about Object
Spy
18) When ordinal identifiers alone
can make an object unique then why they are not given top priority?
Why it is first mandatory and next assistive. Why we cannot go for
ordinal identifiers directly?
Consider the following -
a) If two objects are overlapped
on each other than location based object recognition will
fail.
b) If only index based
recognition is used your script will work but script execution
time will increase.
Hence mandatory and assistive
properties are used.
19) What is the file extension of
the code file in QTP?
Code file extension is script.mts
20) Explain in brief about the QTP
Automation Object Model.
QTP Automation Object model deals
with Automation of QTP itself. Almost all configuration
and functionality provided by QTP is represented by QTP's Automation
Object Model . Almost all dialog boxes in QTP have a corresponding
automation object which can set or retrieved using the corresponding
properties or methods in the Automation Object Model.QTP Automation
Objects can be used along with standard VB programming elements like
iterative loops or conditional statements to help you design a script
of choice.
21) What is the use of Text output
value in QTP?
Text Output values enable you to
capture text appearing on the application under test during
run-time.
If parameterized, text output values
will capture values appearing in each iteration which would be stored
in the run-time data table for further analysis.
22) What is Step Generator?
Step Generator enables use to Add
Test Steps in your script. Using step generator you can add steps
to your script without actually recording it.
23) How to make QTP understand the
difference amongst the same type of objects .Suppose there are
5 check boxes in a page and I have to choose the 2nd one, how to do
that through script?
You can use ordinal identifiers like
index along with a little descriptive programming for
object recognition.
Watch a video
of this example.
24) What is Test Fusion Report ?.
Test Fusion Report , displays all
aspects of a test run and is organized in a Tree format.
It gives details of each step executed
for all iterations.
It also gives Run-time data table,
Screen shots and movie of the test run if opted.
25) How can you handle exceptions in
QTP?
In QTP Exceptional handling is done by
using
a. Recovery Scenarios.
b. Using “On Error” statement
b. Using “On Error” statement
In Recovery scenario you have to
define.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
At Script Level you can use the On
Error Resume Next and On Error Go to 0 statement.
26) What are the types of
environment variables in QTP ?
Environment variables in QTP are of
three types:
1) Built-in (Read only)
2) User-defined Internal
(Read only)
3) User-defined External
(Read/Write)
You Set the Environment Variable using
the following syntax
Environment.Value( "name")
= "Guru99"
You can Retrieve the Environment
Variable using following syntax
Environment.Value("name")
-- This will retrun name as Guru99
Environment.Value("OS")
-- This will return your system OS
27) What is the Difference between
Bitmap Check point & Image Check point?
Bitmap checkpoint does a pixel to pixel comparison of an image or part of an image.
Bitmap checkpoint does a pixel to pixel comparison of an image or part of an image.
Image checkpoint does do a pixel
to pixel comparison but instead compare image properties like
alt text , destination url etc.
28) What is the difference between
functions and actions in QTP?
Actions have their own Object
Repository & Data Table. Actions help make your Test modular and
increase reuse. Example: You can divide your script into Actions
based on functionality like Login, Logout etc.
Functions is a VB Script
programming concept and do not have their own Object Repository or
Data Table. Functions help in re-use of your code. Ex: You can
create a Function in your script to concatenate two strings.
29) What is keyword view and Expert
view in QTP? -
Keyword View is an icon based
view which shows test steps in tabular format. It also
automatically generates documentation for the test steps.
Expert View gives the
corresponding VB Script statement for every test step in the
Keyword view.
30) Explain QTP Testing
process? -
Quick Test testing process consists of
6 main phases:
1) Create your test plan -
This is preparatory phase where you identify the exact test steps,
test data and expected results for you automated test. You also
identify the environment and system configurations required to create
and run your QTP Tests.
2) Recording a session on your
application - During this phase , you will execute test steps one
by one on your AUT ,and QTP will automatically record corresponding
VB script statements for each step performed.
3) Enhancing your test - In this
stage you will insert checkpoints , output values , parameterization
, programming logic like if…else loops to enhance the logic of your
test script.
4) Replay & Debug -
After enhancements you will replay the script to check whether its
working properly and debug if necessary.
5) Run your Tests - In this
phase you will perform the actual execution of your Test Script.
6) Analyzing the test results -
Once test run is complete, you will analyze the results in the Test
Fusion report generated.
7) Reporting defects - Any
incidents identified needs to be reported. If you are using Quality
Center , defects can be automatically raised for failed tests in QTP.
31) What are the different types of
Test Automation Frameworks ?
The types of Automation Frameworks are
-
1) Linear Scripting - Record &
Playback
2) The Test Library Architecture
Framework.
3)The Data-Driven Testing
Framework.
4)The Keyword-Driven or
Table-Driven Testing Framework.
Learn more about Test
Automation Frameworks.
32) How will you check a web
application for broken links using QTP?
You can use the Page Checkpoint
which gives a count of valid/invalid links on a page.
33) What is a Run-Time Data Table?
Where can I find and view this table?
Data like parameterized output ,
checkpoint values , output values are stored in the Run-time
Table. It is an xls file which is stored in the Test Results Folder.
It can also be accessed in the Test Fusion Report.
34) What is the difference between
check point and output value.
Check point is a verification point
that compares a current value for a specified property with the
expected value for that property. Based on this comparison, it will
generate a PASS or FAIL status.
An output value is a value captured
during the test run and can be stored in a specified location
like the Datable or even a variable. Unlike Checkpoints, no
PASS/FAIL status is generated.
34) How would you connect to
database using vbscript ?
To connect to the database you must
know
a) connection string of your server
b) username
c) password
d) DNS name
You can code the database connectivity
command directly or you can use the SQL Query tool provided by QTP.
35) What is QTP batch testing tool?
You can use the Batch testing
tool to run multiple scripts. Once the scripts are added in
the tool , it will automatically open the scripts and start
executing them one after the other.
36) What are the drawbacks of QTP?
As of QTP version 10
1) Huge Tests in QTP consume lots of
memory and increase CPU utilization.
2) Since QTP stores results in HTML
file (and not txt) the result folder sometimes becomes big.
37) What is an Optional Step ?
A step when declared optional is not
mandatory to be executed. If the corresponding GUI object is
present, QTP performs the operation on it. If the GUI object is not
present, QTP bypasses the optional step and proceeds to execute the
next step.
38) What is
Reporter.ReportEvent ?
Reporter.Reportvent is standard method
provided by QTP to send custom messages to the test results
window.
Syntax
Reporter.ReportEvent EventStatus,
ReportStepName, Details [, ImageFilePath]
where
EventStatus = 0 or micPass
1 or micFail
2 or micDone
3 or micWarning
Results can assume any status
like Pass , Fail , Warning etc. You can also send screenshot to the
test results window.
39) How will you declare a
variable in QTP ?
You declare using a DIM keyword.
You assign value to the variable using the SET keyword.
Ex.
Dim temp 'Will declare the temp
variable
Set temp = 20 ' Will assign a
value 20 to temp.
39) What is GetRoProperty ?
GetRoProperty is a standard
method provided by QTP to fetch property values of a run -time
object.
40) What is smart Identification?
Typically, if even one of the on-screen
object property does not match the recorded object property. The test
fails.
In smart identification, QTP
does not give an error if the property values do not match,
but uses Base filter and Optional Filter properties to uniquely
identify an object. In Smart identification, if a property value does
not match the script does not fail but it proceeds ahead to compare
the next property. Smart identification can be enabled in Object
Identification Dialog box.
Learn more about SMART
Identification
41) How would you export a Script
from one PC to another in QTP ?
We can make use of the "Generate
Script" function available in Object Identification, Test
Settings and Tools/Options tab to create a zip of the script at the
source computer. These zip files then can be imported into QTP at the
destination computer.
42) Can launch two instances of QTP
on the same machine ?
No. You can work with only
single instance of QTP on the same machine. But QTP itself can work
on multiple instances of the Application Under Test (AUT). Ex:
QTP can handle multiple IE browser windows.
43) Give the syntax to import/export
xls into QTP.
DataTable.ImportSheet
"..\..\TestData\Input.xls",1,dtGlobalSheet
DataTable.ExportSheet
"..\..\Results\Output.xls","Global"
44) What is SetToProperty ?
SetToProperty changes property of an
object stored in the Object Repository. However these changes are not
permanent.
45) What is the standard timing
delay for web based application in QTP ?
The standard delay is 60 seconds.
This is can be changed in Test Settigns.
46) What is the Action Conversion
Tool ?
It is an in-built tool provided by QTP
to convert Actions into Business Process Components.
47) What is the extension for a
function library ?
The extension is '.QFL'
48) If the Global Data sheet
contains no data and the Local Datasheet contains two rows of data,
how many times will the test iterate?
The test will iterate only once
- global iteration.
49) What factors affect bitmap
checkpoints ?
Bitmap checkpoints are affected by
screen resolution and image size.
50) What is Accessibility
Checkpoint?
World Wide Web Consortium (W3C) came up
with some instructions and guidelines for Web-based technology
and information systems to make it easy for the disabled to access
the web. For example the standards make it mandatory to have an
'alt text' for an image. So a blind person who is accessing the
website, will use text - to -speech converters and atleast understand
what the image is about if not see it. All these standards are
checked by Accessibility Checkpoints.
No comments:
Post a Comment