Highlighted
Absent Member.
Absent Member.
499 views

How to obtain the name of the current running script?

In order to output some important results from runs with loadrunner 12.50 using TruClient I am using the command "Evaluate JavaScript" with the following content:

IO.write(TC.outputDir+"outputScript.txt", orderNumber, false)

to write some text to a file named "outputScript.txt". But, since I use multiple scripts, it would be better if I can output the text to a file that is named like the TruClient Script. For example, the name of the script is

GUI_automate_1

then is there a variable I can access in TruClient which contains the same text?

GUI_automate_1

Or do I have to manually define it myself somewhere in the script?

 

 

0 Likes
4 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to obtain the name of the current running script?

Hi,

You can concatenate TC.userId to the file name.

Regards,

Shlomi

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to obtain the name of the current running script?

Thanks for the suggestion, but I get the folowing error

** 4: Evaluate JavaScript code window.alert(TC.userId);...C.userId, false) ** failed - exception occurred: APIError: LR.getUserIdjsapi.NotSupportedAPI

when I try to display the content of TC.userId with the following code:

indow.alert(TC.userId);

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to obtain the name of the current running script?

Can you please try with LR.userId?

Thanks,

Shlomi

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to obtain the name of the current running script?

Hi,

I just tried to use "LR.userID" in the following command:

window.alert(LR.userId);

but I got the following error message:

 

** 13.1: Evaluate JavaScript code scriptName="PreQA1_porta...lert(LR.userId); ** failed - exception occurred: APIError: LR.getUserIdjsapi.NotSupportedAP

So it is still not working ...

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.