Friday, July 4, 2008

WinRunner Functions

Database Functions

db_check

This function captures and compares data from a database.
Note that the checklist file (arg1) can be created only during record.
arg1 - checklist file.

db_connect

This function creates a new connection session with a database.
arg1 - the session name (string)
arg2 - a connection string
for example “DSN=SQLServer_Source;UID=SA;PWD=abc123″

db_disconnect

This function disconnects from the database and deletes the session.
arg1 - the session name (string)

db_dj_convert

This function executes a Data Junction conversion export file (djs).
arg1 - the export file name (*.djs)
arg2 - an optional parameter to override the output file name
arg3 - a boolean optional parameter whether to
include the headers (the default is TRUE)
arg4 - an optional parameter to
limit the records number (-1 is no limit and is the default)

db_execute_query

This function executes an SQL statement.
Note that a db_connect for (arg1) should be called before this function
arg1 - the session name (string)
arg2 - an SQL statement
arg3 - an out parameter to return the records number.

db_get_field_value

This function returns the value of a single item of an executed query.
Note that a db_execute_query for (arg1) should be called before this function
arg1 - the session name (string)
arg2 - the row index number (zero based)
arg3 - the column index number (zero based) or the column name.

db_get_headers

This function returns the fields headers and fields number of an executed query.
Note that a db_execute_query for (arg1) should be called before this function
arg1 - the session name (string)
arg2 - an out parameter to return the fields number
arg3 - an out parameter to return the concatenation
of the fields headers delimited by TAB.

db_get_last_error

This function returns the last error message of the last ODBC operation.
arg1 - the session name (string)
arg2 - an out parameter to return the last error.

db_get_row

This function returns a whole row of an executed query.
Note that a db_execute_query for (arg1) should be called before this function
arg1 - the session name (string)
arg2 - the row number (zero based)
arg3 - an out parameter to return the concatenation
of the fields values delimited by TAB.

db_record_check

This function checks that the specified record exists in the
database.Note that the checklist file (arg1) can be created
only using the Database Record Verification Wizard.
arg1 - checklist file.
arg2 - success criteria.
arg3 - number of records found.

db_write_records

This function writes the records of an executed query into a file.
Note that a db_execute_query for (arg1) should be called before this function
arg1 - the session name (string)
arg2 - the output file name
arg3 - a boolean optional parameter whether to
include the headers (the default is TRUE)
arg4 - an optional parameter to
limit the records number (-1 is no limit and is the default).

ddt_update_from_db

This function updates the table with data from database.
arg1 - table name.
arg2 - query or conversion file (*.sql ,*.djs).
arg3 (out) - num of rows actually retrieved.
arg4 (optional) - max num of rows to retrieve (default - no limit).

GUI-Functions

GUI_add

This function adds an object to a buffer
arg1 is the buffer in which the object will be entered
arg2 is the name of the window containing the object
arg3 is the name of the object
arg4 is the description of the object

GUI_buf_get_desc

This function returns the description of an object
arg1 is the buffer in which the object exists
arg2 is the name of the window containing the object
arg3 is the name of the object
arg4 is the returned description

GUI_buf_get_desc_attr

This function returns the value of an object property
arg1 is the buffer in which the object exists
arg2 is the name of the window
arg3 is the name of the object
arg4 is the property
arg5 is the returned value

GUI_buf_get_logical_name

This function returns the logical name of an object
arg1 is the buffer in which the object exists
arg2 is the description of the object
arg3 is the name of the window containing the object
arg4 is the returned name

GUI_buf_new

This function creates a new GUI buffer
arg1 is the buffer name

GUI_buf_set_desc_attr

This function sets the value of an object property
arg1 is the buffer in which the object exists
arg2 is the name of the window
arg3 is the name of the object
arg4 is the property
arg5 is the value

GUI_close

This function closes a GUI buffer
arg1 is the file name.

GUI_close_all

This function closes all the open GUI buffers.

GUI_delete

This function deletes an object from a buffer
arg1 is the buffer in which the object exists
arg2 is the name of the window containing the object
arg3 is the name of the object (if empty, the window will be deleted)

GUI_desc_compare

This function compares two phisical descriptions (returns 0 if the same)
arg1 is the first description
arg2 is the second description

No comments:

How to Get files from the directory - One more method

 import os import openpyxl # Specify the target folder folder_path = "C:/Your/Target/Folder"  # Replace with the actual path # Cre...