Patrick the Tester Valued Contributor.
Valued Contributor.
165 views

What can i use instead of TC.getAttr and TC.getParam

Jump to solution

I have a TruClient script where i user TC.getAttr and TC.getParam in some step to make data variable.
In LoadRunner 12.60 is see warnings about these funtions: "The TC.getAttr API is deprecated because it is synchronous. Use the asynchronous "Generic API" step instead.".
I cannot find a clear anwser on how to replace these functions with ones from the generic API.
How do i replace these two functions?
Example of function i use:

"User Nr "+TC.getParam("randomUserNr")+" "+TC.getParam("dateTime")

1 Solution

Accepted Solutions
Micro Focus Contributor
Micro Focus Contributor

Re: What can i use instead of TC.getAttr and TC.getParam

Jump to solution

Hi Patrick,

In newer version, the TC API is deprecated, and instead what must be used are generic API steps. This ensures the parameter acquisition procedure is done atomically, as a single step.

 

How to do it:

Step 1:

Before the place where you wish to use the parameter or attribute, drag a Generic API step from the toolbox

VuGen_2019-06-14_15-44-38.png

Step 2:

Select the TC category and getParam method name.

This individual step will execute atomically.

chrome_2019-06-14_15-45-04.png

Step 3:

Type in the name of the parameter you want to get, and type in the name of the javascript variable you want to be created after.

After the creation you can use that variable anywhere in javascript code inside TruClient.

chrome_2019-06-14_15-45-45.png

Step 4:

Now the variable is available to use.

All you have to do is replace the previous "TC.getParam("myParam")" calls in the javascript code with our new variable, in this case "myParamVar"

Like so:

Replace this

chrome_2019-06-14_15-46-50.png

With this

chrome_2019-06-14_15-47-50.png

Hope that is helpful.

 

Thank you,

Lup. - Micro Focus TC Engineer

2 Replies
Micro Focus Contributor
Micro Focus Contributor

Re: What can i use instead of TC.getAttr and TC.getParam

Jump to solution

Hi Patrick,

In newer version, the TC API is deprecated, and instead what must be used are generic API steps. This ensures the parameter acquisition procedure is done atomically, as a single step.

 

How to do it:

Step 1:

Before the place where you wish to use the parameter or attribute, drag a Generic API step from the toolbox

VuGen_2019-06-14_15-44-38.png

Step 2:

Select the TC category and getParam method name.

This individual step will execute atomically.

chrome_2019-06-14_15-45-04.png

Step 3:

Type in the name of the parameter you want to get, and type in the name of the javascript variable you want to be created after.

After the creation you can use that variable anywhere in javascript code inside TruClient.

chrome_2019-06-14_15-45-45.png

Step 4:

Now the variable is available to use.

All you have to do is replace the previous "TC.getParam("myParam")" calls in the javascript code with our new variable, in this case "myParamVar"

Like so:

Replace this

chrome_2019-06-14_15-46-50.png

With this

chrome_2019-06-14_15-47-50.png

Hope that is helpful.

 

Thank you,

Lup. - Micro Focus TC Engineer

Patrick the Tester Valued Contributor.
Valued Contributor.

Re: What can i use instead of TC.getAttr and TC.getParam

Jump to solution

That is the information i was looking for

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.