Program a Vuser script on Linux

LoadRunner provides a base template for manually programming and compiling a Vuser script on Linux.

Create script from the template

LoadRunner includes a utility on Linux that copies a template into your working folder. The utility is called mkdbtest, and is located in $M_LROOT/bin. You run the utility by typing:

mkdbtest  name

When you run mkdbtest, it creates a folder called name, which contains the template file, name.c. For example, if you type:

mkdbtest test1

mkdbtest creates a folder called test1, which contains the template script, test1.c.

When you run the mkdbtest utility, a folder is created containing four files test.c, test.usr, test.cfg and Makefile, where test is the test name you specified for mkdbtest.

Back to top

Manually compile the script

After you modify the template, you compile it with the appropriate Makefile in the script's folder. The compiler creates a dynamic library called libtest.so.

You can modify the Makefile and assign additional compiler flags and libraries by modifying the appropriate sections.

If you are working with a general template, you must include your application's libraries and header files. For example, if your application uses a library called testlib, include it in the LIBS section.

LIBS         = \
    -testlib \
    -lLrun50 \
    -lm

After you modify the Makefile, type make from the command line in the working folder to create the dynamic library files for the Vuser script.

After you create a script, you check its functionality from the command line. Check that your script communicates with the server and performs all the required tasks. For details, see Run a Vuser script from a Linux command line.

Back to top

See also: