Beruflich Dokumente
Kultur Dokumente
11
Last Updated: August 19, 2004
Introduction
Virtual Table Server (VTS) first edition, introduced the capability for LoadRunner virtual users, WinRunner
and XRunner, to communicate in real time. Data extraction and communication was simplified but limited
to column/queue level operations. The new Virtual Table Server II provides a higher degree of data
manipulation and 5-10 times better performance. From row level queries, retrievals, updates, insertions,
unqueue entries, to database access, VTS II provides the functionality and ease for enhanced inter-process,
inter-virtual user communication.
System Requirements
A 1-CPU 300Mhz+ Windows NT/2000 should be used to run the Virtual Table Server. Since the server is
single threaded, a multi-cpu processor is unnecessary.
The total amount of data the VTS can support is limited by the OSs maximum limit on process memory
(ie. 2GB - 3GB). It has been tested for 1 million entries per row, however the VTSs table will only allow
the user to scroll to 32,767th row.
Installation
1) Obtain VTS2 from Mercury Support Representatives. (Downloadable Binaries)
2) Unzip the file into the main LoadRunner directory (using the directory structure provided).
(eg. \Mercury Interactive\LoadRunner)
3) Register vtsctls.ocx in the \LoadRunner\bin directory.
(eg. regsvr32 c:\Program Files\Mercury Interactive\LoadRunner\bin\vtsctls.ocx)
Server Startup
To bring up the Server Component of VTS, execute the command vtconsole. You can do this in the Run
Box, double clicking on vtconsole.exe in the \LoadRunner\bin directory, or use vtconsole with
command line parameters.
Data Manipulation
Through the use of cursor positioning and the provided operators, you will be able to modify the table to
your liking.
Operation Type
Insert data
element
Insert unique data
Update data
element
Increment data
element
Query data
element
Clear data value
Operation Description
Inserts Operation Data into the column
specified by Column Name.
Inserts Operation Data into the column
specified by Column Name only if it is
unique within the target column.
Updates value of the data element in
Column Name at the selected Location
with new value of Operation Data
Increments the numerical value of the data
element by Operation Data at the selected
Location in column specified by Column
Name.
Obtains the value of the data element in
Column Name at selected Location.
Clears the selected data element at
Clear entire
column
File Import/Export
Importing from text files should be self-explanatory. Make sure the input file has the right
formatting with recognized column delimiters (eg. tab, semicolon, comma, etc). Also, note that
the first row of the column in the file represents the column name in the table. Think of it like a
parameter data file in LoadRunner. The following additional options are available:
Treat data within the file as either a table - every entry is inserted -- or a queue only
non-blank entries are inserted.
Import only unique data from file for each column
Database Import/Export
Database access is performed with ADO-DB. With the appropriate connection string, the user can
import or export data to any type of database. The following connection-string samples, below,
show how various types of databases can be accessed.
Provider for SQL Server
Provider=SQLOLEDB; Data Source=Tigger; Initial Catalog=pubs; User ID=sa;
Password=mypass
Provider for Oracle
Provider=MSDAORA; Data Source=2:; User Id=scott; Password=tiger
Provider for ODBC
DSN=PersonalTours
Driver={SQL Server}; Server=Tigger; Database=pubs; UID=sa; PWD=mypass
Driver={Microsoft ODBC Driver for Oracle; Server=2:; UID=scott; PWD=tiger
From more examples and details on connection strings please consult Microsofts OLEDB or
ADODB manuals (http://msdn.microsoft.com).
Initialization / Termination
vtc_connect
lrvtc_connect
vtc_disconnect
lrvtc_disconnect
vtc_get_last_error
vtc_query_column
vtc_query_row
vtc_send_message
vtc_send_if_unique
vtc_send_row1
Queries
lrvtc_query_column
lrvtc_query_row
Submissions
lrvtc_send_message
lrvtc_send_if_unique
lrvtc_send_row1
Updates
vtc_update_message
lrvtc_update_message
vtc_update_message_ifequa lrvtc_update_message_ifeq
ls
uals
vtc_update_row1
lrvtc_update_row1
vtc_increment
lrvtc_increment
vtc_clear_message
lrvtc_clear_message
vtc_clear_column
lrvtc_clear_column
vtc_clear_row
lrvtc_clear_row
Retrievals
vtc_retrieve_message
lrvtc_retrieve_message
vtc_retrieve_messages1
lrvtc_retrieve_messages1
vtc_retrieve_row
lrvtc_retrieve_row
vtc_create_column
vtc_column_size
vtc_free
vtc_free_list
vtc_noop
Miscellaneous
lrvtc_create_column
lrvtc_column_size
lrvtc_noop
API Details
VTS functions that begin with vtc_ prefix are raw and application independent
functions. Functions that being with lrvtc_ prefix are LoadRunner integrated calls
that automatically equalute LoadRunner parameters and store results into
LoadRunner parameters, for convenience. Any string data or array returned by a
vtc_* call should be freed with vtc_free or vtc_free_list, respectively.
vtc_connect
Initialization/Termination
Generate a VTS Connection Descriptor. A connection to the VTS is not established until
it is needed for message exchange. In case a connection fails during an operation, the
VTS will either retry or return an appropriate error message.
(Raw)
(LR)
PVCI vtc_connect(
char
Int
Int
*servername,
portnum,
options)
PVCI lrvtc_connect(
char
Int
Int
*servername,
portnum,
options)
Parameters:
servername
portnum
options
Remarks:
Examples:
<Raw Sample>
PVCI pvci = 0;
char **columns = NULL;
char **values = NULL;
pvci = vtc_connect(wizard,8888,VTOPT_KEEP_ALIVE);
//
vtc_retrieve_row(pvci,&columns,&values);
//
<LR Sample>
PVCI pvci = 0;
pvci = lrvtc_connect(VtsServer,8888,0);
//
lrvtc_retrieve_row();
//
vtc_disconnect
Initialization/Termination
Disconnects descriptor from VTS Server, and clears the connection handle, thus
becoming obsolete and un-usable.
(Raw)
(LR)
VTCERR vtc_disconnect(
pvci)
VTCERR lrvtc_disconnect()
Parameters:
pvci
Examples:
PVCI
<Raw Sample>
PVCI pvci = 0;
pvci = vtc_connect(wizard,8888,VTOPT_KEEP_ALIVE);
//
vtc_disconnect(pvci);
<LR Sample>
PVCI pvci = 0;
pvci = lrvtc_connect(<VtsServer>,8888,0);
//
lrvtc_disconnect();
vtc_get_last_error
Initialization/Termination
Returns the last error specific to a connection given its Connection Handle.
Query column data at index 10 and free data after use.
(Raw)
(LR)
Parameters:
pvci
Remarks:
Examples:
<Raw Sample>
PVCI pvci = 0;
int rc = 0;
pvci = vtc_connect(wizard,8888,VTOPT_KEEP_ALIVE);
//
rc = vtc_get_last_error(pvci);
//
vtc_query_column
Queries
Retrieves data from a column in the VTS at the specified index (row).
(Raw)
(LR)
pvci,
*columnName,
columnIndex,
**outvalue)
VTCERR lrvtc_query_column(
int
char *columnName,
columnIndex)
Parameters:
pvci
columnName
columnIndex
outvalue
Remarks:
Examples:
<Raw Sample>
//
int rc = 0;
char *value = NULL;
rc = vtc_query_column(pvci, "Col1", 1, &value);
lr_output_message("Query Column 1 Result = %s", value);
vtc_free(value);
//
<LR Sample>
int rc = 0;
rc = lrvtc_query_column("Col1", 1);
lr_output_message("Query Column 1 Result = %s",
lr_eval_string("{Col1}"));
//
vtc_query_row
Queries
Retrieves all data for an entire row in the VTS. Also retrieves the corresponding names
of each column (Raw Function).
(Raw)
(LR)
VTCERR vtc_query_row(
PVCI
Int
char
char
pvci,
columnIndex,
***outcolumns,
***outvalues)
VTCERR lrvtc_query_row(
int
columnIndex)
Parameters:
pvci
columnIndex
outcolumns
outvalue
Remarks:
Remember to free the lists after use (Raw Fuction). LR functions will
automatically store the return value in a parameters using the name of
the column.
Examples:
<Raw Sample>
//
int
char
char
rc
**colnames
**rowdata
= 0;
= NULL;
= NULL;
vtc_send_message
Submissions
(LR)
Parameters:
pvci
columnName
message
outRc
char *columnName,
*message)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_send_message(pvci, "Col1", "1234", &status);
lr_output_message("Send Message Status = %d", status);
//
<LR Sample>
int rc = 0;
rc = lrvtc_send_message("Col1", "1234");
//
vtc_send_if_unique
Submissions
Sends data into a column in the VTS, provided that the value does not already exist.
(Raw)
(LR)
Parameters:
pvci
columnName
message
outRc
char *columnName,
*message)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_send_if_unique(pvci, "Col1", "1234", &status);
lr_output_message("Send Message Status = %d", status);
//
<LR Sample>
int rc = 0;
rc = lrvtc_send_if_unique("Col1", "1234");
//
vtc_send_row1
Submissions
Sends data into a row in the VTS with given column names.
(Raw)
(LR)
VTCERR vtc_send_row1(
PVCI
pvci,
char
*columnNames,
char
*messages,
char
*delimiter,
unsigned char
sendflag,
unsigned short
*outUpdates)
VTCERR lrvtc_send_row1(
char
*columnNames,
char
*messages,
char
*delimiter,
unsigned char
sendflag)
Parameters:
pvci
columnNames
messages
delimeter
sendflag
outUpdates
-
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_send_row1( pvci,
";",
//
<LR Sample>
int rc = 0;
"Name;Password",
"John;LetMeIn",
VTSEND_SAME_ROW, &status);
rc = lrvtc_send_row1(
;,
//
"Name;Password",
"John;LetMeIn",
VTSEND_SAME_ROW);
vtc_update_message
Updates
(LR)
VTCERR vtc_update_message(
PVCI
pvci,
char
*columnName,
int
index ,
char
*message,
unsigned short
*outRc)
VTCERR lrvtc_update_message(
int
char
Parameters:
pvci
columnName
index
message
outRc
char *columnName,
index ,
*message)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_update_message(pvci, "Col1", 1, 1234, &status);
//
<LR Sample>
int rc = 0;
rc = lrvtc_update_message(Col1, 1 , 1234);
//
vtc_update_message_ifequals
Updates
Update data on the VTS at Column and Index only if current value matches conditional
message.
(Raw)
(LR)
VTCERR vtc_update_message_ifequals(
PVCI
pvci,
char
*columnName,
int
index ,
char
*message,
char
*ifmessage,
unsigned short
*outRc)
VTCERR lrvtc_update_message(
int
char
char
Parameters:
pvci
columnName
index
message
ifmessage
outRc
char *columnName,
index ,
*message,
*ifmessage)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_update_message_ifequals(pvci, "Col1", 1, 1234, changeme
&status);
if (status == 1) {
// success: value changed to 1234
} else {
// failure: value did not change.
}
//
<LR Sample>
int rc = 0;
rc = lrvtc_update_message(Col1, 1 , 1234,changeme);
if (rc == 1) {
// success: value was changed to 1234
} else {
// failure: valid did not change (either condition did not meet, or
error occurred)
}
//
vtc_update_row1
Updates
(LR)
Parameters:
pvci
columnNames
index
messages
delimeter
outUpdates
*columnNames,
index ,
*messages,
*delimiter)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_update_row1(pvci,"OrderNumber;Quantity",4321,"8293-OR253;10",";",&status);
//
<LR Sample>
int rc = 0;
rc = lrvtc_update_row1("OrderNumber;Quantity",4321,"8293-OR253;10",";");
//
vtc_increment
Updates
Increments a counter at a specified column and index and returns the new number.
(Raw)
(LR)
VTCERR vtc_increment(
char
int
int
int
PVCI pvci,
*columnName,
index ,
incrValue,
*outValue)
int
char *columnName,
index ,
incrValue)
Parameters:
pvci
columnName
index
incrValue
outValue
lrvtc_increment(
int
int
-
Remarks:
Note that the LR function returns the new value via the function return
mechanism while the raw function returns the value through an argument.
Examples:
<Raw Sample>
//
int
int
rc = 0;
newValue = 0;
vtc_clear_message
Updates
(LR)
VTCERR vtc_clear_message(
PVCI
pvci,
char
*columnName,
int
index ,
unsigned short
*outRc)
VTCERR lrvtc_clear_message(
int
Parameters:
pvci
columnName
index
outRc
char *columnName,
index)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_clear_message(pvci,"Col1",1,&status);
<LR Sample>
int
rc = 0;
rc = lrvtc_clear_message("Col1",1);
//
vtc_clear_column
Updates
(LR)
Parameters:
pvci
columnName
outRc
*columnName)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_clear_column(pvci,"Col1",&status);
<LR Sample>
int
rc = 0;
rc = lrvtc_clear_column("Col1");
//
vtc_clear_row
Updates
(LR)
VTCERR vtc_clear_row(
int
pvci,
int
rowIndex,
unsigned short
*outRc)
VTCERR lrvtc_clear_row(
int
Parameters:
pvci
rowIndex
outRc
rowIndex)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_clear_row(pvci, 1, &status);
<LR Sample>
int
rc = 0;
rc = lrvtc_clear_row(1);
//
vtc_retrieve_message
Retrievals
(LR)
VTCERR vtc_retrieve_message(
char
char
int
pvci,
*columnName,
**outvalue)
VTCERR lrvtc_retrieve_message(
char
Parameters:
Pvci
ColumnName
Outvalue
*columnName)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
char
*outvalue = NULL;
rc = vtc_retrieve_message(pvci, Col1, &outvalue);
//
vtc_free(outvalue);
//
<LR Sample>
//
int
rc = 0;
rc = lrvtc_retrieve_message("Col1");
lr_output_message ("Retrieved value is : %s", lr_eval_string ("Col1"));
//
vtc_retrieve_messages1
Retrievals
Retrieves and clears the first data element from multiple rows as specified by Column
Names.
(Raw)
(LR)
VTCERR vtc_retrieve_messages1(
char
char
char
int
pvci,
*columnNames,
*delimiter
***outvalues)
VTCERR lrvtc_retrieve_messages1(char
*columnNames,
char *delimiter)
Parameters:
Pvci
ColumnNames
Delimiter
Outvalues
Remarks:
Examples:
<Raw Sample>
//
int
char
char
rc = 0;
delimiter = '$';
**outvalues = NULL;
rc = 0;
rc = lrvtc_retrieve_messages1(Col1;Col2, ";");
lr_output_message ("Col1 : %s", lr_eval_string("{Col1}"));
lr_output_message ("Col2 : %s", lr_eval_string("{Col2}"));
//
vtc_create_column
Miscellaneous
(LR)
Parameters:
pvci
columnName
outRC
char
*columnName)
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
rc = vtc_create_column (pvci, NewCol, &status);
//
<LR Sample>
//
int rc = 0;
rc = lrvtc_create_column ("NewCol");
//
vtc_column_size
Miscellaneous
(LR)
VTCERR vtc_column_size(
int
char
int
pvci,
*columnName,
*size)
int lrvtc_column_size(
char
*columnName)
Parameters:
pvci
columnName
size
Remarks:
Examples:
<Raw Sample>
//
int
int
rc = 0;
colSize;
rc = 0;
colSize;
colSize = lrvtc_column_size("Col1");
//
vtc_free
Miscellaneous
*msg)
<None>
Parameters:
msg
The name of the variable passed into the Raw VTS functions
which allocated memory for a return value.
Remarks:
Examples:
<Raw Sample>
//
int
rc = 0;
unsigned short
status;
char
*outvalue = NULL;
rc = vtc_retrieve_message(pvci, Col1, &outvalue);
//
vtc_free(outvalue);
//
vtc_free_list
Miscellaneous
Void vtc_free_list (
char
**msglist)
<None>
Parameters:
Msglist
Remarks:
Examples:
<Raw Sample>
//
int
char
char
rc = 0;
delimiter = '$';
**outvalues = NULL;