Highlighted
Absent Member.
Absent Member.
9564 views

Generate UUID through HP Loadrunner

Jump to solution

Hi. I am writing a C program using the HP LoadRunner C APIs. I am in dire need of generating UUIDs as a part of my program. Does HP LoadRunner have UUID generating APIs\Methods? I did see lr_generate_uuid( as a part of the lrun.h.. but I am not sure how to use it. Please help me out.

THanks!
0 Likes
1 Solution

Accepted Solutions
Highlighted
13 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
Here you go!

char* uuid;
uuid = lr_generate_uuid();
lr_output_message("UUID: %s", uuid );

Output: UUID: 6LX3iPZ4o0KtprQdzcc5bA==

0 Likes
Highlighted
Absent Member.
Absent Member.

Thanks Madhu. But UUID is a 16 byte number. The entries in the UUID are supposed to be Hexadecimal values. Why is this API providing Non-hex values? any ideas on how to convert them to hex format? Thanks for your help with this!

Thanks,
Satish
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
Let me check and I'll get back to you. Please allow me some time.

-Madhu
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
The function you mentioned is not public and it generates a unique value which is not standard UUID format.

0 Likes
Highlighted
Absent Member.
Absent Member.
Yes, I should have re-phrased my question upon doing a bit more research.
I would like to generate unique GUIDs - not UUIDs - the definition and difference of both is varies from place to place. I did see some LR Methods for the same, lrc_GUID(const char *str), but they all need a "Named Object" such as a COM interface as input. I just want to generate random GUIDs without having to worry about COM interfaces.

Thanks,
Satish
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
Try this.

// myHex parameter defined as random number in range 1-65535 and format "%04X"

lr_output_message(lr_eval_string("{myHex}{myHex}-{myHex}-{myHex}-{myHex}-{myHex}{myHex}{myHex}"));

Highlighted
Absent Member.
Absent Member.
Hi
I am working on webservices protocol and my script is created with UUIDs. Any idea how to simulate these UUID when replay. Does correlation concept works here.
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
Srini,

Correlation concept comes into picture, when something coming from Server,you want to capture and use it in subsequent requests to server.

If the UUID is generating at client side, then we cannot do this directly in LR. Refer to my previous post it may help.


0 Likes
Highlighted
Highlighted
Absent Member.
Absent Member.

Scott, this really helped!! Thanks so much!!
0 Likes
Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

The Loadtester.com site is moving. The new location for this page is:

 

http://northwaysolutions.com/our-work/blog/2010/07/loadrunner-guid-creator

 

Thanks

,Scott

Thanks,

Scott Moore
Scott Moore Consulting LLC
http://scottmoore.consulting
TWITTER: @loadtester
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.