attach a text document using Globals.h
Question ID: 105604

How to attach a text document present in the local machine using Globals.h in VUGen

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on September 28, 2014 11:49 am
Answers (2)
Private answer

Files in globals.h are assumed to be there to support the compile of the script. Placing a file name there does Not automatically include it with the script when downloaded to a different load generator. So it might compile in VUgen but fail when directed to another load generator.

If you are using a local file that is on the same system as the vugen is going to compile against, ie myspecials.h, you would use the ''#include filename'' or #include ''myspecials.h''.

If the file is in the search path, you put the name in double quotes, like you see in globals.h for, say, a web script.

#include ''lrun.h''

You can also hard code a path like

#include ''C:Program Files (x86)HpLoadRunnerincludelrun.h''

Surprisingly, a UNC to a share also works, or at least compiles :)

#include ''\localhostC$Program Files (x86)HpLoadRunnerincludelrun.h''

Your best bet is to copy your file where LR Vuser compiles already look. That can be the load runner include directory, or the script's directory where the action.c resides (or vuser_end.c or vuser_init.c). That is also in the search path for the compiler.

Best bet is to include it in the script directory where the action.c, vuser_init and vuser_end reside. That is where the ''additional files'' comes in (v11.5x and v12.x). In earlier versions you would do it through the scenario that would allow you to specify additional files.
''Additional files'' is also good for keeping other types of files in the script itself and accessing them through C functions like fopen, fscanf, fread, etc. By default, when you open a filename without path info, it opens the file in the script directory.

Hope that helps. Good luck.

Marked as spam
Posted by (Questions: 0, Answers: 15)
Answered on October 10, 2014 6:03 am
Private answer

Not totally sure what you are asking, but you can add text files or any other files by right clicking on the extra files folder and browsing to the file and adding it. The file will then stay with the script.

Marked as spam
Posted by (Questions: 0, Answers: 2)
Answered on October 9, 2014 1:40 pm

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

Scroll to Top