Understanding Constants and Variables - WinRunner

Constants and variables are used in TSL to manipulate data. A constant is a value that never changes. It can be a number, character, or a string. A variable, in contrast, can change its value each time you run a test.

Variable and constant names can include letters, digits, and underscores (_). The first character must be a letter or an underscore. TSL is case sensitive; therefore, y and Y are two different characters. Certain words are reserved by TSL and may not be used as names.

You do not have to declare variables you use outside of function definitions in order to determine their type. If a variable is not declared, WinRunner determines its type (auto, static, public, extern) when the test is run.

For example, the following statement uses a variable to store text that appears in a text box.

WinRunner reads the value that appears in the File Name text box and stores it in the text variable. A report_msg statement is used to display the value of the text variable in a report. For more information, see “Sending Messages to the Test Results Window”. For information about variable and constant declarations, see “Creating User-Defined Functions.”

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WinRunner Topics