1

In LoadRunner, given a parameter table stored in a file MyTable.dat and a VUGEN script written in C#:

FirstHeader,SecondHeader,ThirdHeader
1A,1B,1C
2A,2B,2C
3A,3B,3C

I can use lr.eval_string("{MyTable}"); to return a whole row:

1A,1B,1C

I can use lr.next_row("MyTable.dat"); to advance to the next row

2A,2B,2C

However, it's not clear how to select an individual column.

The function reference for scripts written in C states that you can use lr_paramarr_idx for parameter arrays - but that doesn't appear to be available in C# & it doesn't make clear if a table row counts as a parameter array.

HP VUGen version 9.52.0.0.

Iain
  • 10,433
  • 16
  • 56
  • 62

3 Answers3

1

Define individual parameters assigned to the different columns with your defined separator. If you have commas within your data, then use a different data separator, such as a tab (tsv format file) or I commonly use a pipe '|' symbol. If you don't have individual parameters set up and assigned to the individual columns then you will need to grab the whole row and break it apart yourself.

See lr.next_row() and lr.advance_param(). You may be using one where with the parameters explicitly defined you will want to use the other. lr.advance_param() would be the more common use, keeping in mind that when you iterate you are going to pick up some of this advancement on a natural basis, depending upon the definition of your parameters.

Given your questions you will want to take a look at two sections of the LoadRunner documentation, (1) the documentation on the parameterization engine for LoadRunner and (2) the section in the VUGEN manual dealing with advanced concepts and building virtual users in Visual Studio (there is some reinforcement on the parameterization concepts here).

James Pulley
  • 5,606
  • 1
  • 14
  • 14
  • I see that you're a "loadrunner" guy. How did you learn loadrunner? – Pacerier Dec 04 '14 at 03:56
  • I was hired for my foundation skills as a field systems' engineer by Mercury Interactive. I was put through product training and placed in the field with a mentor for two weeks. The only reason why two weeks was sufficient is because I had all of the foundation skills needed for the job, having worked in development, for an operating system vendor, a database vendor and a network vendor before coming to the field of performance testing. My architecture and troubleshooting skills were already mature. Without mature foundations there are people struggling after years of tool use. – James Pulley Dec 04 '14 at 13:06
  • What do you mean by "field systems engineer" and "placed in the field"? – Pacerier Dec 06 '14 at 23:51
  • 1
    MY job was to understand the architecture of the client systems, apply that knowledge to the architecture of the tool and to identify where and how the tool and the client systems would work together on a pre-sales basis, to run POC events (where necessary) and later to deliver on services as part of the professional services team. But, before I could operate independently (being place in the field), I needed to go through training and work with a peer for a period of time to assist in bringing together my foundation skills, my training in tools and process and the tool at hand – James Pulley Dec 07 '14 at 15:31
  • Hmm, which protocols are the ones you use? Is your speciality on the `Web - HTTP/HTML` protocol? – Pacerier Dec 26 '14 at 23:18
  • Over the past 20 years I have used all of the protocols. Yes, eery last one on the file->new list from Winsock through Citrix. Since 2000 the dominant market model for new software deployment has been based upon HTTP protocol technology – James Pulley Dec 28 '14 at 12:20
  • Btw, I've tried JMeter too and when compared to LR, I'm thinking that JM seems much better economically/business-ly speaking. What's your experience with JM and why do you use LR instead of JM? – Pacerier Sep 15 '15 at 10:45
  • Every solution has both a labor quotient and a tool quotient to meet final budget. The labor quotient will vary with the capabilities of the tool in much the same way that a butt end of a screwdriver to put in a roof will differ from a pneumatic nailer. Be careful when you select a tool that your overall cost will be as low as possible when accounting for both labor and tool license for the period in question. Note: Commercial tools can be leased for as low as a one month period, virtual users for as short as one day. – James Pulley Sep 15 '15 at 13:23
0

Just use the column name that you want to work with.

lr_eval_string("{FirstHeader}");

Gus
  • 1
0

This is a bad answer:

private string[] GetRowCells(string parameter)
{
    string row = lr.eval_string("{" + parameter + "}");
    return row.Split(',');
}

This is bad because:

  • If LoadRunner provides the facility for table parameters, there must be the capability for querying individual columns.
  • The above doesn't take account of columns that may include comma in their body:

For example, the following won't be parsed correctly:

FirstHeader,SecondHeader
"1,A","1,B"
"2,A","2,B"
"3,A","3,B"
Iain
  • 10,433
  • 16
  • 56
  • 62