QTP: Some useful Typecasting functions QA Enginners use in real time
1. CINT
This functions coverts string into integer.
Ex.
dim avalue="7"
dim bvalue="10"
if avalue >bvalue then
print avalue is greater
end if
Output:

Corret Code:
dim avalue,bvalue
avalue="7"
bvalue="10"
if (cint(avalue) >cint(bvalue)) then
msgbox "avalue is greater"
end if
Output: does not print anything as 7 is not greate than 10
CBool
To return a Boolean value of an expression for true/false condition
1. CINT
This functions coverts string into integer.
Ex.
dim avalue="7"
dim bvalue="10"
if avalue >bvalue then
print avalue is greater
end if
Output:
Corret Code:
dim avalue,bvalue
avalue="7"
bvalue="10"
if (cint(avalue) >cint(bvalue)) then
msgbox "avalue is greater"
end if
Output: does not print anything as 7 is not greate than 10
CBool
To return a Boolean value of an expression for true/false condition
No comments:
Post a Comment