Adding Comments and White Space - WinRunner

When programming, you can add comments and white space to your test scripts to make them easier to read and understand.

Using Comments

A comment is a line or part of a line in a test script that is preceded by a pound sign (#). When you run a test, the TSL interpreter does not process comments. Use comments to explain sections of a test script in order to improve readability and to make tests easier to update.

For example:

# Open the Open Order window in Flight Reservation application
set_window ("Flight Reservation", 10);
menu_select_item ("File;Open Order..."); # Select the reservation for James Brown
set_window ("Open Order_1");
button_set ("Customer Name", ON);
edit_set ("Value", "James Brown"); # Type James Brown
button_press ("OK");

You can use the Insert comments and indent statements option in the Record > Script Format category of the General Options dialog box to have WinRunner automatically divide your test script into sections while you record based on window focus changes. When you choose this option, WinRunner automatically inserts a comment at the beginning of each section with the name of the window and indents the statements under each comment. For more information on the Insert comments and indentstatements option, see “Setting Script Format Options”

Inserting White Space

White space refers to spaces, tabs, and blank lines in your test script. The TSL interpreter is not sensitive to white space unless it is part of a literal string. Use white space to make the logic of a test script clear.

Inserting White Space

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

WinRunner Topics