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.
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
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
I assume you have the username details in parameter file, right?
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.
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.
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
i have same requirement, How you are getting machine name in truclient? Thanks in advance.
You can keep in variable like that
var compName = Utils.getEnv("COMPUTERNAME");