how to use vts with loadrunner

20
How to use VTS with LR Kranthi Paidi 1

Upload: kranthi-paidi

Post on 14-Jun-2015

2.226 views

Category:

Technology


11 download

DESCRIPTION

Virtual Table Server and How to use it with LoadRunner

TRANSCRIPT

Page 1: How to use VTS with loadrunner

How to use VTS with LR

Kranthi Paidi

1

Page 2: How to use VTS with loadrunner

What is VTS

2

VTS – Virtual Table Server A windows service which maintains an in memory database that can be accessed

by a number of load generators on a network VTS helps different data dependent scripts “talk-to” each other during a load test Unlike the parameter files which involves file operation in order to be changed

once the test starts and thus bringing in concurrency issues, VTS holds and shares the values that “producer” scripts generate so that “consumer” scripts can act upon the data.

For example, if a script called Add_Issue generates an Issue ID which is assigned to a particular user, using VTS, this Issue ID can be “inserted” into a “table” during run time and “retrieved” by Close_Issue script by that particular user.

Thus, VTS can be treated (and is a kind of) database. The only difference here is that you cannot “query” this database. For example, you

cannot write a query like “select * from table_1 where user_ID=“kpaidi”” HP LoadRunner does not “officially” provide any support to VTS. This is a third

party “add-in” that you have to use by yourself.

Page 3: How to use VTS with loadrunner

What is VTS

3

Even though HP does not support this tool, thousands of users have used this and are still using it without any problems.

The last available version is VTS 2. This is no longer being developed, but, VTS2 is completely stable and has no issues reported over a significant time.

Attached in this slide is VTS.rar which has all setup files required.

VTS

Page 4: How to use VTS with loadrunner

Installing VTS

4

Minimum system requirements: A 1-CPU 300Mhz+ Windows NT/2000

The total amount of data that VTS supports is limited by the Operating System’s maximum limit on process memory (2Gig to 3 Gig)

VTS is tested for 1 million entries per row. It supports only 32,767 rows VTS should be installed on your controller(s) and all load generators that you intend

to make use of in your load test. For each machine, do the following:

Extract the zip file and click vtsinstall.exe VTS automatically selects “C:\Program Files\HP\LoadRunner as installation directory Select install Open cmd prompt with elevated privileges Cd to “C:\Program Files\HP\LoadRunner\bin” Type regsvr32.exe vtsctls.ocx Type regsvr32.exe msflxgrd.exe

Page 5: How to use VTS with loadrunner

Setting up the Server

5

If your tests involve large data creation and consumption, please plan to have a separate machine as VTS server other than controller and load generator. Working on large sets of data will have its impact on the memory and network bandwidth thus affecting the load generators and controller. You do not want to introduce bottlenecks in the test design itself.

If your tests have minimal amount of data being operated up on (not more than a few MB), choose a less utilized load generator.

Whatever the machine you choose, determine the physical IP of the machine using “ipconfig /all” command from cmd prompt.

Once you determined the IP, check what ports are available on the machine. Use the command “netstat –an”. Choose a port that is available (I am choosing 8888 here)

Once you do the above, open a notepad and type the following ECHO ON CD “C:\Program Files\HP\LoadRunner\bin\” START vtconsole –port 8888 –launch

Page 6: How to use VTS with loadrunner

Setting up the Server

6

Save the notepad as “START_VTS.bat” on a location you prefer (I prefer Desktop) Click the batch file. You should see a window like this –

Page 7: How to use VTS with loadrunner

Setting up the Server

7

Your VTS server is UP and READY now. You can use this as a database to store and retrieve values during a scenario run.

In the next few slides, we will see how to connect to a VTS from a VUGen script, how to write data, how to retrieve data and error handling.

Page 8: How to use VTS with loadrunner

Connecting to VTS from VUGen

8

Include the following at the top of vuser_init, action, vuser_end sections #include “as_web.h” #include “vts2.h” Your init, action and end sections will look like this –

In the vuser init section, write the following code to connect to VTS

Page 9: How to use VTS with loadrunner

Connecting to VTS from VUGen

9

In the vuser_end section, write the following code. This disconnects the vuser from vtc.

If your VTS is up and running (remember the START_VTS.bat?), running the above VuGen code should not write any messages to the output screen. It should look like below:

Page 10: How to use VTS with loadrunner

Connecting to VTS from VUGen – Error Codes

10

If you have any problems with VTS, the following error codes are returned: #define VTCERR_INVALID_CONNECTION_INFO -10000 > verify the server name attribute. #define VTCERR_FAILED_TO_RESOLVE_ADDR -10001 #define VTCERR_FAILED_TO_CREATE_SOCKET -10002 #define VTCERR_FAILED_TO_CONNECT -10003 > the vtconsole is not running. #define VTCERR_INCOMPLETE_REQUEST -10100 #define VTCERR_FAILED_TO_RECV_RESPONSE -10101 #define VTCERR_INCOMPLETE_RESPONSE -10102 #define VTCERR_RESPONSE_ARGS_UNMATCH -10103 #define VTCERR_OPERATION_ERROR_BASE -11000

Page 11: How to use VTS with loadrunner

Writing data into the server - example

11

Page 12: How to use VTS with loadrunner

Data Manipulation in VTS

12

Insert Data Element: Inserts operation data into the column specified by column name

Insert Unique Data: Inserts operation data only if the data is unique

Update Data Element: Updates the value of data element in the column name at selected location

Increment Data Element: Increments the numerical data element in the column name at selected location by the number

specified

Query data element: Obtains the value of the data element in the column name at location specified

Clear Data Value: Clears the data in the column name at location specified

Clear Entire Column: Clears the entire column

Page 13: How to use VTS with loadrunner

Client side API – LR functions

13

VTS supports two types of functions. Raw VTS functions and LR version of the same functions. The definitions for both the type of functions are available in vts2.

We will discuss and see only LR version of the fuctions Connect/Disconnect:

PVCI lrvtc_connect(char *servername, int portnum, int options); Options: 0 for None, VTOPT_KEEP_ALIVE for keep connection alive

PVCI is a typedef int variable

lrvtc_disconnect();

Query a Column: retrieves data from a Column specified by name and index lrvtc_query_column(char *ColumnName, int RowIndex);

Query a Row: retrieves data from all columns in a row specified by row index lrvtc_query_row(int RowIndex);

Page 14: How to use VTS with loadrunner

Client side API – LR functions

14

Send data to a column: sends data to the next row of the column specified lrvtc_send_message(char *columnName, char *columnValue);

Send unique data to a column : sends a data to the next row of column only if it is unique in that column lrvtc_send_if_unique(char *columnName, char *columnValue); Returns 1 for pass and 0 for fail

Page 15: How to use VTS with loadrunner

Client side API – LR functions

15

Send entire row: Sends data into a row with specified column names lrvtc_send_row1(char *columnNames, char *messages, char *delimiter, unsigned char

sendflag); Status code returned PVCI 1=pass, 0=fail

Update data: Updates data at specified column and index lrvtc_update_message(char *columnName, int Index, char *message);

Page 16: How to use VTS with loadrunner

Client side API – LR functions

16

Update entire row: Updates row data at specified column index lrvtc_update_row1(char *columnNames, int index, char *messages, char *delimiter);

Clear Message: Clears the data at specified column and Index lrvtc_clear_message(char *columnName, int index);

Page 17: How to use VTS with loadrunner

Client side API – LR functions

17

Clear Column: Clears all data in the given Column lrvtc_clear_column(char *columnName);

Clear row: Clears all data in a row of specified index lrvtc_clear_row(int index);

Page 18: How to use VTS with loadrunner

Client side API – LR functions

18

Retrieve message: retrieves and clears the first data element from a column lrvtc_retrieve_message(char *columnName);

Page 19: How to use VTS with loadrunner

Client side API – LR functions

19

Retrieve multiple messages: retrieves and clears the first data element from a row as specified by column names lrvtc_retrieve_messages1(char *columnNames, char *delimiter);

Page 20: How to use VTS with loadrunner

Thank You

20