Highlighted
Absent Member.
Absent Member.
2058 views

using parameters in strings in TC 12.53

Jump to solution

Is there a full tutorial that SHOWS TruClient gui syntax examples!? This protocol is most frustrating to use if you are an old LR code dog. I am well versed in LR parameters and usage in a variety of protocols but can't figure out this basic usage in 12.53: logically I want to LOG the value of the {password} parameter, as in:

password: bean

I have create a single (custom) parameter in the vuGen Parameter List:  password, and assigned it a single value: bean:

param.jpg

But the following GUI step fails (and I have tried several variations that all also fail); by fail I mean the step executes but it logs the string literal  TC.getParam("password") rather than logging the value of the password parm (bean😞

TC.log.jpg

What is the correct method AND syntax to do this? Also, how then do I concatenate the prefix string "password: " to the value? (I thought it should be "password: " + TC.getParam("password") but I am just not catching the notion of this protocol's syntax and it features, thats for sure).

-Thanks, Terry Horwath

 

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Super Contributor.
Super Contributor.

Re: using parameters in strings in TC 12.53

Jump to solution

Hi

Remove the double quotes for TC.getParam,

TC.log(TC.getParam("Password"), "Standard");

thanks

Ravi 

View solution in original post

0 Likes
5 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: using parameters in strings in TC 12.53

Jump to solution

Hi Terry,

TruClient has a very detailed online documentation help center that is up to date and keeps updating with each release.

it can be accessed through this link.

Specifically on Parameters - you can consult this page

I hope this guides you in the correct direction.

Good Luck,

Lior

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: using parameters in strings in TC 12.53

Jump to solution

I tried to use that specific HELP section you reference on parameters before I posted this request. This and other TC help pages are not showing examples to help me solve my specific issue as described above. If you would please provide a concrete example that addresses my problem it will be most appreciated.

-Terry

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: using parameters in strings in TC 12.53

Jump to solution

Hi

Remove the double quotes for TC.getParam,

TC.log(TC.getParam("Password"), "Standard");

thanks

Ravi 

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: using parameters in strings in TC 12.53

Jump to solution

Arg. My problem was two fold:

1.  I am using FF to develop the script and enabled its log. I expected that TC.log(TC.getParam("password"), "Standard"); messages would be written to that (FF) log during development. But that is not happening (which I consider pretty lame). TC.log() messages are only being logged to output.txt (the Replay log) when the script is run under vuGen.

2. I was trying to use an Execute TC.log() step, rather than an Evaluate JavaScript step. So it appears to me that you can't use a parameter in Execute TC.log() step because it's Argument string is always encapsulated in double quotes, as in:

TC.log.jpg

3. To complete this thead for any other newbie that finds the use of parameters in logging perplexing hereis this is the Step that works now showing the GUI step that needs to be used:

TC.log.jpg

 

 

 

 

Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: using parameters in strings in TC 12.53

Jump to solution

Hi Terry,

I'll address each of the issue you raised in this last post:

  1. TC.log writes to TruClient log, which is available even after the browser is closed, to allow offline analysis.
    In Firefox, you can view the log during replay - in General SettingsInteractive OptionsFirefox Settings > enable Display log messages.
    The log can also be viewed in VuGen ('Firefox - Interactive' for the interactive replay).
    To write directly to the Firefox console, use 'window.console.log'.
  2. That does seem to be an issue with TruClient. I will make sure it is reported and handled in a future release.
  3. That is a good workaround for issue #2.

Edo

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.