Use lr_get_attrib_string() to read the command line argument
VuGen has an -infiniteiterations option to specify the script to run infinite times. There is not currently a command line option available to specify the exact number of iterations.
1. In VuGen, select Run-Time Settings -> Additional attributes.
2. Create an argument name (for example, "iter"), and give a default argument value of 2.
3. Use a for loop in the Action item, and repeat the action "iter" number of times.
Example:
Action()
{
int iterations, i;
iterations = atoi(lr_get_attrib_string("iter"));
for (i = 1; i <= iterations; i++)
lr_output_message("This is a test, iteration is %s", lr_get_attrib_string("iter"));
return 0;
}
Note:
If you have any parameters declared in the script that are set to change values for each iteration, you may want to change them to each occurence so it takes a different value for each time it runs.
From the command line you can now run the script as
"LoadRunner install dir" \bin\mmdrv.exe -usr "path to .usr file" -out "path_to_output_directory" -iter "no_of_iters"
VuGen has an -infiniteiterations option to specify the script to run infinite times. There is not currently a command line option available to specify the exact number of iterations.
1. In VuGen, select Run-Time Settings -> Additional attributes.
2. Create an argument name (for example, "iter"), and give a default argument value of 2.
3. Use a for loop in the Action item, and repeat the action "iter" number of times.
Example:
Action()
{
int iterations, i;
iterations = atoi(lr_get_attrib_string("iter"));
for (i = 1; i <= iterations; i++)
lr_output_message("This is a test, iteration is %s", lr_get_attrib_string("iter"));
return 0;
}
Note:
If you have any parameters declared in the script that are set to change values for each iteration, you may want to change them to each occurence so it takes a different value for each time it runs.
From the command line you can now run the script as
"LoadRunner install dir" \bin\mmdrv.exe -usr "path to .usr file" -out "path_to_output_directory" -iter "no_of_iters"