VTS parameterization

This topic describes using Virtual Table Server (VTS) parameterization with your TruClient 2.0 - Web script.

About using VTS parameterization

When you run a script that contains a parameter, the parameter must be assigned a value each time the parameter is called. There are two methods for assigning values to parameters:

  • Standard parameterization. Using this method, each Vuser is assigned parameter values from a dedicated set of values. Parameter values are not shared between Vusers. For details, see Use parameters in scripts.
  • VTS parameterization. VTS is a web-based application that works with Vuser scripts. It enables you to assign parameter values from a single set of values to multiple Vusers. This may enable you to more accurately emulate a real user environment.

TruClient includes dedicated API functions to enable Vusers to connect to the VTS server, and to read and modify data stored in the VTS table.

For details on installing and using VTS, see Virtual Table Server.

Back to top

Connect to a VTS server

To use VTS parameterization during a load test, the Vuser needs to connect to the installed VTS server.

To connect to a VTS server:

  1. Open the Steps box Miscellaneous tab, and drag an Evaluate JavaScript step to the required location in the script.

  2. To enable connection to the VTS, use one of the following functions in the Arguments > Code box in the step.

    This function supports HTTP, HTTPS, basic authentication, and NTLM authentication:

    Copy code
    (async () => { 
        await TC.vtcConnectEx("serverName", port, "UserName", "password", "domain", "vtsName");
    })();

    This function supports HTTP:

    Copy code
    (async () => { 
        await TC.vtcConnect("serverName", port, "vtsName");
    })();

    Argument information:

    • You can identify the server either by domain name or by IP address.

    • The default API access port is 8888.

    • Creating an alias (vtsName) for the server will make it easier to identify which VTS you are referencing in your code, if you are using more than one server.

  3. Play the added connection step, to verify the connection to the VTS server.

  4. Add other VTS API steps, as relevant. See Use VTS API functions in your script.

  5. To disconnect from the VTS, add another Evaluate JavaScript step, and enter the following in the Code box.

    Copy code
    (async () => { 
        await TC.vtcDisconnect("vtsName");
    })();

Tip:  

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

  • 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.

Back to top

Use VTS API functions in your script

TruClient has dedicated functions to manage data in the VTS table, and to evaluate parameters. You can directly call a VTS function in a step. You can also create a variable and use it to pass VTS parameters to another step in your script.

For details on the available functions, see TruClient 2.0 - Web VTS functions in the VuGen Function Reference.

To add VTS API functions to your script:

  1. Add a step to connect to VTS to your script. For details, see Connect to a VTS server.

  2. To directly call a function from a step, add a Generic Browser Action step from the Steps box Functions tab.

    Enter the required function in the Argument > Location box.

    For example, when parameterizing a URL, you might use the following to retrieve the data in field 1, and store it in a parameter with the same name as the column, "Web Sites".

    Copy code
    (async () => { 
        await TC.vtcGetCell("Web Sites",1,"MyVTS");
    })();
  3. To create a variable for a VTS parameter:

    1. Add an Evaluate JavaScript step at the required location in the script. In the Argument > Code box, define your variable. For example, var websites = TC.vtcGetCell("Web Sites",1,"MyVTS");

    2. Add a Generic Browser Action step to your script, and in the Argument > Location box, enter the defined variable.

Back to top

See also: