Highlighted
New Member.
3566 views

Using multiple parameters in Load Runner

Jump to solution

Hi,

I have a script where I need to have multiple column in the parameter file. Example

UN.dat

Username,dataInfo

user1,data1

user2,data2

 

How do I access each value from the parameter file ?

Thanks

 

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Using multiple parameters in Load Runner

Jump to solution

Please see attachec screenshot to understand how to configure your parameter.

The code in the Evalaute JavaScript step should look like that:

var userName = TC.getParam("UserName");
var cycle = TC.getParam("Cycle");

Regards,

Shlomi

View solution in original post

0 Likes
7 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Using multiple parameters in Load Runner

Jump to solution

Hi

I reccomend reading the documentation on parametrization in LoadRunner in this link.

In high level, you declare the parameter in the script like so {username}, {dataInfo} and define how the parameters will be assigned through their assignment method: Sequential, random, unique (see more information in this link and here as well).

Good Luck,

Lior

0 Likes
Highlighted
New Member.

Re: Using multiple parameters in Load Runner

Jump to solution

Hi,

I dont see how do I get each column data after I call LR.getParam("UN") .

I am calling LR.getParam("UN") when UN is the name of the file.

What is returning is the value appear in the second column.

Thanks

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Using multiple parameters in Load Runner

Jump to solution

Hi,

You need to use TC.getParam("ColumnName") where ColumnName is the name of the column under which the correct value appears.

BTW: TC.getParam and LR.getParam are the same. I recommend using TC.getParam

Regards,

Shlomi

0 Likes
Highlighted
New Member.

Re: Using multiple parameters in Load Runner

Jump to solution

Hi,

I define the parameter as attach in file.

I call the following two lines :

    truclient_step("1", "Evaluate JavaScript code var X = TC.getParam('UN')", "snapshot=Action_1.inf");
    truclient_step("2", "Evaluate JavaScript code TC.log('username = ' + X)", "snapshot=Action_2.inf");

and I get :

t=00004511ms: username = user1 [MsgId: MMSG-205180]

But How do I get the value of the second column ? What am I missing here ? I

BTW - Can I use this value inside xpath to find element?

Thanks

 

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Using multiple parameters in Load Runner

Jump to solution

Hi,

Use the following code in the Evaluate JavaScript step

 

var userName = TC.getParam("Username");
var cycle =  TC.getParam("Cycle");

 

If you wish to use this value in object identification later you need to switch to JavaScript identification and concatenate the following code instead of the value that appeats in the original Xpath expression

ArgsContext.userName 

I advice watching TruClient Webinar series on YouTube. Here is a link for a session dedicated to Object Identification

https://www.youtube.com/watch?v=PStYMuphfqE 


Regards,

Shlomi

0 Likes
Highlighted
New Member.

Re: Using multiple parameters in Load Runner

Jump to solution

Hi,

I am getting this error :

** 1: Evaluate JavaScript code var X = TC.getParam("Username") ** failed - exception occurred: API_ERROR_UNEXPECTED: TC.getParam Error: The Parameter or Attribute is undefined.

It only works when I use 

TC.getParam("UN") // UN is the name of the parameter

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Using multiple parameters in Load Runner

Jump to solution

Please see attachec screenshot to understand how to configure your parameter.

The code in the Evalaute JavaScript step should look like that:

var userName = TC.getParam("UserName");
var cycle = TC.getParam("Cycle");

Regards,

Shlomi

View solution in original post

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.