Tag Archive: vugen

Use the below functions in Vugen to overcome this error.




Use the below functions in Vugen script to overcome this error.

web_set_sockets_option (“CLOSE_KEEPALIVE_CONNECTIONS”, “1”);
web_set_sockets_option(“OVERLAPPED_SEND”, “0”);
web_set_sockets_option(“IGNORE_PREMATURE_SHUTDOWN”, “1”);

char *date=”27 mar 2010″;
char *position;
int offset;
char *search_str[20] = {“jan”,”feb”,”mar”,”apr”,”may”,”jun”};
char *search_strvalue[20] = {“01″,”02″,”03″,”04″,”05″,”06″};
char * tokens;
char reqValue[100];
int i,j;

lr_output_message(“%s”,lr_eval_string(“New date is {date_new}”));

position = (char *)strstr(date, search_str[j]);
offset = (int)(position – date + 1);
} while (offset != 4);

tokens=(char *)strtok(lr_eval_string(“{date_new}”),” “);
while (tokens!=NULL)
strcat(reqValue, ” “);
strcat(reqValue, search_strvalue[j-1]);
strcat(reqValue, ” “);
tokens = (char *)strtok(NULL,” “);
lr_save_string(lr_eval_string(reqValue), “NewFormatDate”);

return 0;

Put this code inside the action:-

char filename[1024], command[1024];
char new_dir[] = “C:\\Sample”;

/* Create a directory under root called xyz and make it the current dir */
if (mkdir(new_dir))
lr_output_message(“Create directory %s failed”, new_dir);
lr_output_message(“Created new directory %s”, new_dir);

sprintf (filename, “%s\\%s”, new_dir, “SIVA.txt”);

/* Execute a dir /b command and direct it to a new file */
sprintf (command, “dir /b c:\\ > %s /w”, filename );
lr_output_message(“Created new file %s”, filename);

return 0;

Sometimes there might be a requirement to keep some files in the LG machine for temporary use. Have the file included in the script which needs to be copied to LG machine. Use the below mentioned commands to create a temporary folder inside c:\temp folder and copy the file from script folder to newly created folder in LG machine. Once the use of file is completed, use the last command to delete the newly created folder. Char command1[]=”mkdir \”c:\\temp\\\ext_jar”;

Char command2[]=”xcopy /Y filename.pdf \”c:\\temp\\\ext_jar\””;

Char command3[]=”RD /S /Q \”c:\\temp\\\ext_jar\””;





In Loadrunner script, we use block size per vuser for using the huge range of unique values in a parameter. But during the test, if the execution failes inbetween its very hard to re-allocate the block size again by checking the unused values. In-order to solve this issue, we can use the LR_ADVANCE_PARAM function in loadrunner. Please find below the usage format to implement this.

int x,y,v,i;  // declare these variables as integer
v=atoi(lr_eval_string(“{VuserID}”));  // get the VuserID and store it in v
i=atoi(lr_eval_string(“{ItNum}”));  // get the Iteration number and store it in i
 x=v;  // For the first iteration, x = VuserID
 x=6;  // For the second iterations onward, x = No of Vusers  + 1 (assuming Vusers = 5)
lr_advance_param(“CreatedCustID”);  // parameter file name (keep settings as Sequential Once)



return 0;

LoadRunner:   Anatomy of a Script

When you record and save a LoadRunner script in Vugen, there are a number of files that are created. Here’s what they are, and what they do and identification of the files you can safely delete..

Files Required for Playback
During the course of recording and playback of scripts, the Vugen application will create many files, but only some of them are necessary for playback (either in Vugen or the Controller).

For example, say you have script named PerformancEngineer, with two Actions, Home and Forums, then the required files you would need in the PerformanceEngineer script directory would be:

* PerformanceEngineer.usr
* default.usp
* default.cfg
* globals.h
* Home.c
* Forums.c
* vuser_init.c
* vuser_end.c
* PerformanceEngineer.prm

Here’s what is in each file:

PerformanceEngineer.usr: Primarily, the .usr file defines which actions are used by the script. There are other properties which define which protocols are used and other settings, but most of the info

default.usp: Contains the run logic for the script

default.cfg: Contains the run-time settings (except for run-logic)

globals.h: The global headers file- visible and editable in Vugen

*.c (Action files): These are the action files containing your script code. You can edit these files in any text editor, if you want. Sometimes it is easier than starting up Vugen

PerformanceEngineer.prm: Containes the parameter definitions

*.dat: Your data files, you can save these in the script directory or somewhere else, even a mapped network drive on a different server
Files Created During Vugen Playback

All of the files listed below can safely be deleted and not affect your ability to use the script.

result1: One or more result directories are created which contain script playback results

*.idx: The .idx files are binary “index” files created by Vugen for holding parameter values


combined_PerformanceEngineer.c: A list of #includes for all of your Actions

logfile.log, mdrv.log: random log files which you will probably never need to look at

mdrv_cmd.txt, options.txt: These text files contain commands and arguments for the script compiler and driver (mdrv) and are created dynamically, so you can safely delete them.

output.txt: This one is important. This file contains all of the log messages generated during script playback. The contents of this file appear in the “Output Window” section of Vugen

output.bak: A backup of the above file

pre_cci.c: Output from the C pre-processor, which contains all of the functions used in your scrip, from all of the Acitons and header files.

In summary, you can delete: *.txt, *.log, *.idx, *.bak, result*, pre_cci.c, combined_*, *.ci
Files Created During Recording

The ‘data’ directory in your script directory contains the script recording data. I usually delete this so it doesn’t get checked into my version control system, but you may want to keep it around if you use the graphical scripting mode and/or you want to compare playback vs. recording. The auto-correlation feature makes use of this data, too, but I haven’t had much sucess using that feature.

(This has been referred from the site performanceengineer.com)