About Enhancing Your Test Scripts with Programming - WinRunner

When you record a test, a test script is generated in Mercury Interactive’s Test Script Language (TSL). Each line WinRunner generates in the test script is a statement. A statement is any expression that is followed by a semicolon. Each TSL statement in the test script represents keyboard and/or mouse input to the application being tested. A single statement may be longer than one line in the test script.

For example:

TSL is a C-like programming language designed for creating test scripts. It combines functions developed specifically for testing with general purpose programming language features such as variables, control-flow statements, arrays, and user-defined functions. You enhance a recorded test script simply by typing programming elements into the test window, If you program a test script by typing directly into the test window, remember to include a semicolon at the end of each statement.

TSL is easy to use because you do not have to compile. You simply record or type in the test script and immediately execute the test.

TSL includes four types of functions:

  • Context Sensitive functions perform specific tasks on GUI objects, such as clicking a button or selecting an item from a list. Function names, such as button_press andlist_select_item, reflect the function’s purpose.
  • Analog functions depict mouse clicks, keyboard input, and the exact coordinates traveled by the mouse.
  • Standard functions perform general purpose programming tasks, such as sending messages to a report or performing calculations.
  • Customization functions allow you to adapt WinRunner to your testing environment.

WinRunner includes a visual programming tool which helps you to quickly and easily add TSL functions to your tests. For more information, see “Generating Functions.”

This chapter introduces some basic programming concepts and shows you how to use a few simple programming techniques in order to create more powerful tests. For more information, refer to the following documentation:

  • The TSL Reference includes general information about the TSL language, individual functions, examples of usage, function availability, and guidelines for working with TSL. You can open this online reference by choosing Help > TSL Reference. You can also open this reference directly to the help topic for a specific function by pressing the F1 key when your cursor is on a TSL statement in your test script, or by clicking the contextsensitive Help button and then clicking a TSL statement in your test script.
  • The TSL Reference Guide includes general information about the TSL language, individual functions, function availability, and guidelines for working with TSL. This printed book is included in your WinRunner documentation set. You can also access a PDF version of this book, which is easy to print, by choosing Help > Books Online and then clicking Test Script Language from the WinRunner Books Online home page.

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

WinRunner Topics