AdvancedQTP Forums
Sponsored by Solmar Knowlege Networks
Return to advancedqtp
Home
Search
Login
Register
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Advanced search
18120
Posts in
4741
Topics- by
31743
Members
- Latest Member:
suuraj
you are here:
AdvancedQTP Forums
»
AdvancedQTP Forums
»
General QTP Q&A
» (Moderators:
Paul Grossman
,
Stefan Thelenius
,
Asiq Ahamed
)Case sensitivity for values
corp-lt Theme designed by
padexx
« previous
next »
Pages: [
1
]
Go Down
0 Members and 1 Guest are viewing this topic.
Author
Topic:
Case sensitivity for values
(Read 304 times)
spsuresh
User
Offline
Posts: 37
Case sensitivity for values
«
on:
March 01, 2010, 04:21:49 AM »
Hi all,
Kindly clarify this one for me.
Say i am going to perform a check for a value in a particular field.
Eg:
Say my expected value is "QTP" - in upper case.
In my test at run time this value may appear in upper case or lower case.Hence if it appears as lower case the script fails.
I want the script to pass if the value is correct( The value can be in upper or lower case). Is there any way to achieve this.
Regards
Suresh
Logged
Asiq Ahamed
Moderator
Sr. User
Offline
Posts: 459
Re: Case sensitivity for values
«
Reply #1 on:
March 01, 2010, 04:45:24 AM »
Hi Suresh,
You can solve this using regular expression.
Logged
Gautham Maroli
FRProject
Full User
Offline
Posts: 155
Re: Case sensitivity for values
«
Reply #2 on:
March 01, 2010, 07:02:20 AM »
You can use LCase or Ucase on the retrived text and compare
Logged
Christian Desserich
Full User
Offline
Posts: 121
Re: Case sensitivity for values
«
Reply #3 on:
March 01, 2010, 07:56:08 AM »
Code
GeSHi (qtp):
Dim
runtimeText, regEx
'Change this to match your application -->
runtimeText = Browser
(
"Browser"
)
.
Page
(
"Page"
)
.
WebElement
(
"WebElement"
)
.
GetROProperty
(
"innertext"
)
'runtimeText = "qtp"
Set
regEx =
New
RegExp
regEx.
Pattern
=
"QTP"
regEx.
IgnoreCase
=
True
'All of these strategies will return True if runtimeText has "QTP",
'"qtp", "Qtp", "qTp", "qtP", "QTp", or "qTP" anywhere in the string
'Asiq's -->
MsgBox
regEx.
Test
(
runtimeText
)
'Gautham's -->
MsgBox
UCase
(
runtimeText
)
=
"QTP"
'InStr function set to "Textual Compare" -->
MsgBox
InStr
(
1
, runtimeText,
"QTP"
,
vbTextCompare
)
>
0
Created by GeSHI 1.0.7.20
Logged
chinnu chinnu
Sr. User
Offline
Posts: 305
I am working as a SW test engineer and having good knowledge on QTP, i hope it will helpful to me and others.
Re: Case sensitivity for values
«
Reply #4 on:
March 01, 2010, 10:11:17 AM »
Hi,
1> If ur expected and actual values are same but case sensitive then go
If StrComp(act,exp,1)=0 Then
Msgbox"correct
else
Msgbox"not correct
End If
2> If ur expected is a part of actual value but case sensitive then go
(means exp string within actual string)
If InStrComp(1,act,exp,1)>0 Then
Msgbox"correct
else
Msgbox"not correct
End If
3> mexp=LCase(Exp)'Convert to Lcase
mAct=LCase(Actual)'Convert to Lcase
If mexp=mAct Then
Msgbox"correct
else
Msgbox"not correct
End If
Logged
Always with you,
Chinnu
Thamarai Kannan Selvan
User
Offline
Posts: 15
Re: Case sensitivity for values
«
Reply #5 on:
March 03, 2010, 05:17:23 AM »
Please try this method.
Read the value from application during run time. Use "Ucase" function, to convert the text to upper case, you issue will be resolved.
Logged
Pages: [
1
]
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
AdvancedQTP
-----------------------------
=> Bulletin Board
-----------------------------
AdvancedQTP Load & Performance Forums
-----------------------------
=> Load & Performance Q&A
-----------------------------
AdvancedQTP Forums
-----------------------------
=> General QTP Q&A
=> Web Q&A
=> Web Services Q&A
=> .Net Q&A
=> Java Q&A
=> ActiveX Q&A
=> SAP Q&A
=> TE Q&A
=> Siebel Q&A
=> Quality Center Q&A
-----------------------------
AdvancedQTP Products Support
-----------------------------
=> Reporter Manager Q&A
-----------------------------
AdvancedQTP Free Tools Forums
-----------------------------
=> AutoIt Q&A
-----------------------------
FR Project Forum
-----------------------------
=> FR Project
-----------------------------
AdvancedQTP Forums Support Center
-----------------------------
=> TroubleShooting
Loading...