Use VTS in TruClient

This task describes an example of how to use VTS in a TruClient script.

What is VTS?

  • HPE LoadRunner Virtual Table Server - or VTS for short - is a Web-based application that is built to work with LoadRunner Vuser scripts. VTS offers an alternative to standard LoadRunner parameterization.

  • When you use standard LoadRunner parameterization, each Vuser is assigned parameter values from a dedicated set of values - parameter values are not shared between Vusers. In contrast, VTS enables you to assign parameter values from a single set of parameter values to multiple Vusers. This may enable you to more accurately emulate a real-user environment.

  • VTS includes a table that contains parameter values that can be used by your Vuser scripts. The VTS table is composed of columns and rows. Each column represents a set of values that can be used by a specific parameter in your Vuser scripts. The cells within a column contain the actual values of the parameter.

Back to top

How to install VTS

For details on installing VTS, see Installing the Virtual Table Server (VTS) in the VuGen Help Center.

Back to top

How to connect/disconnect to a VTS server

  1. Select Toolbox > Miscellaneous and add an step to your script.

  2. To connect to a VTS, enter TC.vtcConnect(“server”,port,"alias") in the Arguments > Code section of the step.

    You can identify the server either by name or by ip address.

    Example: TC.vtcConnect("myServer",8888,"myVTS");

  3. To disconnect from a VTS, enter TC.vtcDisonnect("alias") in the Arguments > Code section of the step.

Tip:  

  • Before you replay the script, play the TC.vtcConnect step (from within the step) to verify the connection to the VTS server.

  • If you are unable to connect to a remote VTS server, configure the firewall on the VTS server machine, making sure the connection to the VTS port or process is enabled.

  • Once you have established a connection to the VTS server, you can play other VTS API steps, modify them and replay again.

  • Replaying the entire script will automatically disconnect the VTS even if there is no disconnect step in your script.

Examples of connecting and disconnecting to a server:

  • Using a server name and alias:

    TC.vtcConnect(“MyServer”,8888,”UsersTableVts”); 
    TC.vtcDiscconect(“UsersTableVts”); 

    For details on the use of aliases, see Why do you need an alias for your VTS server?

  • Using the server ip address and alias:

     TC.vtcConnect(“192.168.1.133”,8888,”WorkersTableVts”);
     TC.vtcDiscconect(“WorkersTableVts”); 
  • Using the server name without an alias:

     TC.vtcConnect(“MyServer”,8888);
     TC.vtcDiscconect(); 
  • Using the server ip address without an alias:

    TC.vtcConnect(“192.168.1.133”,8888);
    TC.vtcDiscconect(); 

Back to top

Why do you need an alias for your VTS server?

If you are using more than one server, creating an alias for each server will simplify identifying which VTS your are referencing in your code.

Back to top

How to use Eval JavaScript code step to pass VTS parameters to another step.

You can use the Eval JavaScript code step to pass VTS parameters to another step in your script. The example below shows you how to parameterize a URL.

  1. Connect to a VTS server
    1. Select Toolbox > Miscellaneous and add an step to your script.
    2. To connect to a VTS, enter TC.vtcConnect(“server”,port,"alias") in the Arguments > Code section of the step.
  2. Create a step that contains a variable.
    1. Select Toolbox > Miscellaneous and add an step to your script.
    2. In Argument > Code section enter define your variable.

      For example, to get data from the server enter var ws = TC.vtcGetCell("Web Sites",1,"alias");

  3. Select Toolbox > Functions and add a Generic Browser Action to your script.
  4. Enter the variable you defined in Step 2 in Argument > Location .

Back to top

How to use a VTS API function directly in a step.

You can use the Eval JavaScript code step to call a VTS function in your script. The example below shows you how to parameterize a URL.

  1. Connect to a VTS server
    1. Select Toolbox > Miscellaneous and add an step to your script.
    2. To connect to a VTS, enter TC.vtcConnect(“server”,port,"alias") in the Arguments > Code section of the step.
  2. Select Toolbox > Functions and add a Generic Browser Action to your script.
  3. Enter TC.vtcGetCell("Web Sites",1,"alias");in the Argument > Location section of the script.

Back to top

See also: