Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Having problem with Verification
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Req: I need to search customer with first and last name. In return result will be (Last Name Coma Space FirstName). I wrote the follwoing code

Code:
If str_TestCaseId="TC007_PolicySearch_By_FirstAndLastName"  Then
GetReturnedName=Browser(".").Page(".").WebElement(".").GetROProperty("innerhtml")
ReturnedNameFormat= str_LastName&","&" "&str_FirstName

If GetReturnedName=ReturnedNameFormat  Then
Reporter.ReportEvent micPass, "Search returned  proper format of insured name by searching First and last name",""
Reporter.ReportEvent micFail,"Search did not return  proper format of insured name by searching First and last name", ""
End If
End If

As always I belive this forum is the best place to get the solution
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
I probably will be able to modify the code to suit better but wouldnt guarantee that it will validate the functionality you are looking for. I would request you to elaborate more on what you intend to do?

Code:
If str_TestCaseId="TC007_PolicySearch_By_FirstAndLastName"  Then
GetReturnedName=Browser(".").Page(".").WebElement(".").GetROProperty("innerhtml")
ReturnedNameFormat= str_LastName&","&" "&str_FirstName

If StrComp(Trim(GetReturnedName),Trim(ReturnedNameFormat))>0  Then
    Reporter.ReportEvent micPass, "Search returned  proper format of insured name by searching First and last name",""
Else
     Reporter.ReportEvent micFail,"Search did not return  proper format of         insured name by searching First and last name", ""
End If
End If
Please be aware that if you are not keen on Character casing then you may want to use Ucase or Lcase to format both the strings to a particular case and then perform a Comparision. Because, Strcomp function will fail if the character cases are different.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Awesome! It is like one click solution!!
I have a silly question

In If StrComp(Trim(GetReturnedName),Trim(ReturnedNameFormat))>0 I don't understand >0. =0 would make more sense to me. I tried with =0 but failed. Waiting for your help again.
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
My mistake and a thousand apologies. It should be,
Code:
StrComp(Trim(GetReturnedName),Trim(ReturnedNameFormat))=0

The result is returned as such,

-1 if Str1 is less than Str2,
1 if Str1 is greater than Str2
0 if the strings are the same.

You may want to try the below to check what is happening with your code,
Code:
msgbox StrComp(Trim(GetReturnedName),Trim(ReturnedNameFormat))=0
This will help you to check which string is greater and what is the reason it is failing.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  XML Verification naani12 0 1,924 08-01-2012, 07:38 AM
Last Post: naani12
Shy Email Verification using QTP Brian T. 0 5,607 05-10-2011, 11:42 PM
Last Post: Brian T.

Forum Jump:


Users browsing this thread: 1 Guest(s)