QTP/UFT: Generate Alphanumeric and Random Number

”’## 3 digits Random idNumber and 7 digits Random serialNumber
    Dim start, ends
    start = 1
    ends = 19
    For m = start To ends
        idNumber = RandomNumber (111919)
        serialNumber = RandomNumber (11119991119999)

”## Generate Alphanumeric Number
Function generateAlphanumeric(StrLen)
Dim alpNumStr
For i = 1 to StrLen
  alpNumStr=alpNumStr & Mid(MainStr,RandomNumber(1Len(MainStr)),1)
generateAlphanumeric = alpNumStr
End Function
”## 3 digits Alphanumeric Number
serialNum = generateAlphanumeric(3)


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s