Highlighted
Super Contributor.. Super Contributor..
Super Contributor..
1232 views

Load Runner - TruClient

Jump to solution

Hi,

My testcase is I need to execute a TruClient script in different locations like Munich, Sydney, Princeton etc.

I will logon each location with a different username say for Munich - MUC - Bindu, Sydney - ASIA -Bindu etc

I want to retrieve the logged on username through script. My point is when I execute script, the results should be Logged in USer - MUC - Bindu.

Please let me know how it should be implemented.

 

Best Regards!

Bindu

 

 

 

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Load Runner - TruClient

Jump to solution

For the first one you can also use: Utils.getEnv("USERNAME"); in Evaluate JavaScript step

Regards,

Shlomi

View solution in original post

0 Likes
9 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Load Runner - TruClient

Jump to solution

Hi,

This question is not specific to TruClient, it is applicable for other protocols as well.

You can achieve that using LoadRunner integration with HPE Network Virtualization (See this demo video: https://www.youtube.com/watch?v=03KebefKr-c)

or using Cloud Load Generators located in these locations (LoadRunner has an integration with cloud providers)

or using StormRunner, which is a cloud based performance testing solution

Regards,

Shlomi

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: Load Runner - TruClient

Jump to solution

Hi Shlomi,

Thanks for the info.

But that doesnt work for me. Because I want to retrieve username through VUGenscript and write that into a Notepad file.

I want o do this in TruClient scripting using C /C++ language

Best Regards!

Bindu

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Load Runner - TruClient

Jump to solution

Hi,

I assume you have the username details in parameter file, right?

If so, you should use an Evaluate JavaScript step with the following code in it

 

var userName = TC.getParam("userNameParam"); //replace userNameParam with your parameter name
TC.log("user name is: " + userName); // this will write the information to the log

if you wish to write the data to your own file you can use the following code

var userName = TC.getParam("userNameParam"); //replace userNameParam with your parameter name
IO.write(TC.scriptDir + "userNameData.txt", userName + "\n");
// you can write the data under a different path in a different file name.
// See IO. functions in http://tchelp.saas.hpe.com/en/12.53/Content/TruClient/reference/functions.htm

use userName variable in later steps for the actual authentication. Note that if you canll TC,getParam twice in the same iteration it might advance the parameter cursor depending on the policy you chose.

Regards,

Shlomi

 

 

Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: Load Runner - TruClient

Jump to solution

Hi Shlomi,

I know the way which you specified using parameters, but I want in a different way.

First - I am not storing username in a parameter.

I will execute my script on different machines at different locations for continuously to collect response times and I have specific user at each location.

My script will be common and will not have any parameters. I am retrieving host name of that location through TC.evalC("getHostName",60) and Hostname is my variable declared in TruClient scripting like var HostName = TC.gerParam("host"); and i have code in Extra Files -> C-functions.c  like lr_save_string(lr_get_host_name(), "host");

I am looking for a similar code for getUserName. Once I execute script,dynamically it should display logged username.

Hope its clear for you.

Best Regards!

Bindu

 

 

 

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Load Runner - TruClient

Jump to solution

Hi,

Are you referring to the Windows Logged On user or to the user logged on to the application?

If it is the first one check out this link: http://stackoverflow.com/questions/24503466/how-to-get-user-name-using-c-programming 

If it is the later you should be able to get either from the credentials the script is using or from a page in the application where it is displayed

Regards,

Shlomi

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Load Runner - TruClient

Jump to solution

For the first one you can also use: Utils.getEnv("USERNAME"); in Evaluate JavaScript step

Regards,

Shlomi

View solution in original post

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: Load Runner - TruClient

Jump to solution

Hi Shlomi,

Thanks for your reply.

My problem is solved.  Thank you so much.

Best Regards!

Bindu

 

Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Load Runner - TruClient

Jump to solution

Hi Bindu,

i have same requirement, How you are getting machine name in truclient? Thanks in advance.

Regards,
hp4u
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Load Runner - TruClient

Jump to solution

Drag Evaluate JavaScript step from the toolbox and use Utils.getEnv("COMPUTERNAME")

You can keep in variable like that 

var compName = Utils.getEnv("COMPUTERNAME");
0 Likes
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.