Highlighted
Absent Member.
Absent Member.
400 views

Need help on determining correct parameter setting in VUGen

LoadRunner ver. 12.05

VUGen Protocol: Web HTTP/HTML (using LR DB functions to work with the DB)

We have a requirement in one of our projects as mentioned below:

We are inserting data into the DB with ~300 rows and each row with 5 columns of data (one parameter file with all input data formatted as a Table). Number of VUsers are 3. When the script is run in Controller, the VUsers should pick the data from the parameter file as follows,

1st VUser -> 1st row

2nd VUser -> 2nd row

3rd VUser -> 3rd row

and in the next iteration,

1st VUser -> 4th row

2nd VUser -> 5th row

3rd VUser -> 6th row and so on.

With this requirement, please let me know the correct parameter setting and/or any other VUGen C function(s) I can use to achieve this. Am free to set the scenario setting as per the requirement.

Please do let me know if you need any additional information.

0 Likes
3 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Need help on determining correct parameter setting in VUGen

Hi

This one was tricky and to my knowledge not possible to do in a straight forward way.

Using a file parameter and the "unique" then the lines are divided in blocks and the first vuser will get line 1-100, second 101 to 200 and third 201 to 300.

I would a used a File parameter and set it to "update once".

In vuser_init I would have used lr_whoami() to find out which vuser I am, and then for vuser1 do nothing for vuser2 do lr_advance_param() once and for vuser3 do lr_advance_param() twice.

Then in Action have the last thing that happens to be calling lr_advance_param() three times.

This will give you the wanted behavior.

As you have multiple columns in your data file I would probably have done a helper function that is called as above, that do lr_advance_param() for all used columns.

Or would I have done it in a complete different way 🙂

br /ola


Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.

 

 

.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Need help on determining correct parameter setting in VUGen

Thanks for your reply. In the parameter data file, I have set 3rd column to be incremented and remaining columns set as 'Same line as 3rd column'. If possible, please provide a pseudo-code as you have explained, so that I can convert it to actual C code to achieve the requirement.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Need help on determining correct parameter setting in VUGen

Yes of course you should select one column as the "master" and then all the rest as "Same as column X". Then you would not need the helper function. But be sure to set it to "update once" and chck if "id" is 0 or 1 based and change the times you want to run it accordingly.

In vuser_init someting like

int id, scid, i;
char *vuser_group;
lr_whoami(&id, &vuser_group, &scid);

// advance zero, one or two times depending on vusernumber
for (i=0 ; i<id; i++){
  lr_advance_param("column_3");
}

and then in action:

  // Allways advance 3 times
  for (i=0; i<3 ; i++){
    lr_advance_param("column_3");
  }
} //last ting to happen in action
.
Tags (1)
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.