What is Test Script Language?

Spread the love
  • 1

What is Test Script Language?
What is Test Script Language?

What is Test Script Language?


The term TSL stands for “Test Scripting Language”. TSL is procedural language-similar to C programming language.TSL is having different category to perform different tasks.It has constructs,like statements,comments,variables,mathematical operators,control statements,and functions.

Feature list and description:



Allows users to enter human readable information in the test script that will be ignored by the

Naming Rules

Rules for identifiers within TSL.

Data Types

The different types of data values that are supported by the language.

Data Storage

Constructs that can be used to store information.


Different type of computational operations.


Avoids executing certain portions of the code unless a condition is met.


Repeats execution of a certain section of code.


Group of statements used to perform some useful functionality.

Basically this language is created by Mercury Interactive to support their own products.All the recorded scripts that WinRunner/Loadrunner/X-runner creates when you perform an operation is in TSL code syntax. Keep in mind that while mastery of TSL is not required for creating automated
tests, knowledge of the language helps to enhance the recorded tests and to create highly sophisticated tests. Skillful usage of TSL can limit the need for manual intervention when running your test. It can also make your test less errorprone.The TSL language is very compact containing only a small number of operators and keywords.A very interesting thing about TSL is that it is really easy to understand if you have little amount of knowledge in programming language.

Rules and GuideLines:

1.Semicolon after every valid line..


if (j>8) then
do this ;

2.Compound statements or Complex statements use curly braces and not semicolons

See the above statement where if (j>8) then is a complex statement which is guiding the next statement ,…is braced with {}.

3.TSL is a case sensative language.

Most of time it is lower case. The best practise will be to use a lowercase most often

4.Comments will be started with “#”. Anything after this “#” will be ignored by the interpreter.If it is placed in the first character of the line then it comments all the line…called a line commenter or full commenter

if it appears inbetween of the line,it comments the characters after “#” till last character of that line.

Multiline comment is not supported by TSL.


# this is a sample test script created by ani01104 on 12-09-09....Full Comment

if (a>9) then # to check if the value is greater than 9……..Partial comment
do this ;

5.Do a structured test script while you create multiline complex scripting.

if (a>9) then
do this;
if (a=14) then
do something;

what i mean here is to indent the code

6.Try dong a version Control while changing a code.


# Wrote login function on 12-05-09
# Modified the button press on 19-05-09

Naming Conversion of TSL:

Naming Convention:

1.Naming should be in a standard.This is as per naming convention of your company.
2.It starts with a letter or underscore.
3.Do not use reserve/inbuilt keywords for this language.
Ex- “For”,”If” can not be used as a keyword.
4.Do not use any other special character except underscore(_).
Ex-!,@,# can not be used inside a variable.
5.Through out the script use different different name for variables.Case-sensitivity can also give birth different variables.
Ex-StrUrl,srtUrl,strurl are different in this script.These are 3 different variables.

Types of TSL Functions

Four basic types of Functions exist in Test Scripting Language.
Analog functions
Context Sensitive functions
Customization functions
Standard functions

Analog Functions

This is usefull when you record in analog mode.Analog mode talks about the exact coordinates of the GUI map.Analog functions record and execute operations at specified screen coordinates. When you record in Analog mode, these functions are used to catch mouse clicks, keyboard input, and the exact coordinates where the mouse has gones(clicks). When you run a test, Analog functions retrace the mouse tracks and exactly resubmit the input you recorded.Analog functions also support different test operations such as synchronization, verification, and text manipulation.

The Products on which Analog functions are available:
LoadRunner GUI Vusers on PC Platforms
The analog functions can again be classified bases on their operation. The various analog functions available are:

Bitmap Checkpoint Functions:

check window – Compares a bitmap of an AUT window to an expected bitmap.

Input Device Functions:

Click, get, move, mtype, type are the various input device functions.
click clicks a mouse button
click_on_text clicks a mouse button on a string
dbl_click double-clicks a mouse button
get_x returns the current x-coordinate of the mouse pointer
get_y returns the current y-coordinate of the mouse pointer
move_locator_abs moves the mouse to a new absolute position
move_locator_rel moves the mouse to a new relative position
move_locator_text moves the mouse to a string
move_locator_track moves the mouse along a prerecorded track
mtype clicks one or more mouse buttons type specifies keyboard input

Synchronization functions:

wait_window is an example of synchronization functions.wait_window waits for a window bitmap to appear in order to synchronize test execution.

Table Functions:

Various table operations can be performed through these functions. Classic examples of table operations are clicking a table cell, double clicking a table cell, dragging a table.
tbl_click_cell clicks in a cell in a JFC JTable object
tbl_dbl_click_cell double-clicks in a cell in a JFC JTable object
tbl_drag drags a cell to a different location within a JFC JTable object

Text Checkpoint Functions:

Example: Click on text, find, get, move locator to a specified text
click_on_text clicks on a string
find_text searches for a string
get_text reads text from the screen
move_locator_text moves the mouse to a string


Context-Sensitive Functions

Context Sensitive functions depict actions on the application under test in terms of GUI objects (such as windows, lists, and buttons), ignoring the physical location of an object on the screen. In Context Sensitive mode, each time you record an operation on the application under test (AUT), a TSL statement is generated in the test script which describes the object selected and the action performed.
Different context-sensitive functions can be summarized as follows:
Active Bar Functions
ActiveX/Visual Basic Functions.
Bitmap Checkpoint Functions
Button Object Functions
Calendar Functions
Database Functions
Data – driven test Functions
GUI related Functions
Java Functions
List and Menu object Functions
Oracle Functions
WAP Functions
Web Functions, etc.
the syntax of button_press function is:
button_press ( button [, mouse_button ] );
The button parameter may be the logical name of the button—for example:
But it can also be the physical description—for instance:
button_press(“{class:push_button, label:”OK”}”);

Standard Function:

Standard functions include the general elements of a programming language, such as basic input and output, control-flow, mathematical, and array functions. By combining these elements with Analog and Context Sensitive functions, you can transform a simple test into an advanced testing program.
The various standard functions can be summarized as follows:
Arithmetic Functions
Array Functions
Call Statements
Compiled Module Functions
I/O Functions
Load Testing Functions
Operating System Functions, etc.
Customization Functions
Customization functions allow you to enhance your testing tool so that it better supports your specific needs. For example, you can add functions to the Function Generator, or create custom GUI checkpoints.
The various customization functions are:
Custom Record Functions
Custom User Interface Functions
Function Generator Functions
GUI Checkpoint Functions

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 1


Please enter your comment!
Please enter your name here