Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Number generator and verification problem
#5
Solved: 10 Years, 9 Months, 3 Weeks ago
Waooo Man! I see I am learning. I don't know how long you will support me in thsi way. I am already in love of this site and ofcourse you!! Ha haa. Yes, I had problem with verification. I used same method you taught me for Reg Ex verification. I did.
-----------------------------------------------------------
Code:
upperbound=99  
lowerbound =10
CatEventCode=Int((upperbound - lowerbound + 1) * Rnd + lowerbound)  

        Browser("ClaimCenter_Br").Page("ClaimCenter_Pg").WebEdit("Cat/EvenetCode").Set CatEventCode
CatastrophyEventCode=Browser("ClaimCenter_Br").Page("ClaimCenter_Pg").WebEdit("Cat/EvenetCode").GetROProperty("value")

Set RegEx=CreateObject("VBScript.RegExp")
RegEx.Pattern="[0-9]+"
BllnResult=RegEx.Test(CatastrophyEventCode)

If BllnResult=True Then
    Reporter.ReportEvent micPass,"2 digits value is entered in <CAT/EvenetCode> field",""
    Call Logger(1," 2 digits value is entered in <CAT/EvenetCode> field")
    else
    Reporter.ReportEvent micFail,"2 digits value is not entered in <CAT/EvenetCode> field",""
    Call Logger(2,"2 digits value is not entered in <CAT/EvenetCode> field")
End If
Set RegEx=Nothing
------------------------------------------------------------

But I am going to replace these with your new codes.It is more logical and I ve just learned a new thing. Great buddy. Thanks again.


Hi, I am sorry as my reply goes on top of yours. I think I need to reply from Quick Reply section.

So to covert string to Intiger Cint is used. What about Intiger to string? Sorry for dumb question.

Yes bro! I have just changhed my previous codes. IT works fine. Thanks again

Here it is

Code:
upperbound=99  
lowerbound =10
CatEventCode=Int((upperbound - lowerbound + 1) * Rnd + lowerbound)  

        Browser("ClaimCenter_Br").Page("ClaimCenter_Pg").WebEdit("Cat/EvenetCode").Set CatEventCode
StrCatEventCode=Browser("ClaimCenter_Br").Page("ClaimCenter_Pg").WebEdit("Cat/EvenetCode").GetROProperty("value")

needs to be coverted to Intiger
IntCatEventCode=Cint(StrCatEventCode)
If  IntCatEventCode=CatEventCode Then
    Reporter.ReportEvent micPass,"2 digits value is entered in <CAT/EvenetCode> field",""
    Call Logger(1," 2 digits value is entered in <CAT/EvenetCode> field")
    else
    Reporter.ReportEvent micFail,"2 digits value is not entered in <CAT/EvenetCode> field",""
    Call Logger(2,"2 digits value is not entered in <CAT/EvenetCode> field")
End If
Reply


Messages In This Thread
RE: Random Number generator and verification problem - by jinnah - 09-28-2012, 04:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create a random number starting with an alphabet QTPmate 4 3,871 07-31-2014, 09:29 AM
Last Post: QTPmate
  Random Values from Drop-Down profqa 5 5,733 12-06-2013, 09:01 AM
Last Post: basanth27
  Creating Random String SomeIntern 0 4,790 08-21-2013, 09:10 PM
Last Post: SomeIntern
  Export verification QAVA 1 2,492 11-05-2012, 10:25 AM
Last Post: sshukla12
  How to choose a random no from list alwarselvam 0 3,089 12-24-2011, 08:28 AM
Last Post: alwarselvam

Forum Jump:


Users browsing this thread: 1 Guest(s)