|
|
iTestBot script syntax |
|
Introduction - Functions Overview - Home Page Online There are some basic syntax features used in iTestBot:
The examples below will help to understand how everything works. Variables The declaration of variables in iTestBot is similar more to php and basic ideology, e.g. the variable can be declared anywhere in the script.
There are also some specific ways to declare variables, which help in test automation: Functions The example below will show how to use functions in iTestBot. First, we need to create a basic function main. From the main function we call previously declared function test. function test(a1, a2: integer;
a3: string): integer; { the result of script execution is the message 'test' first and then the message '7', which is the sum of passed variables. } Please, note: in the same way you can pass parameters to screen-related functions. For instance: cancel_btn:='cancel_button.bmp'; a:=MouseFocuse(cancel_btn,100); and it is a good place to show how to use if operator Using IF operator There are pascal standard IF... else operators, here is an example: cancel_btn:='cancel_button.bmp'; // please, note: there must be cancel_button.bmp image in the project a:=MouseFocuse(cancel_btn,100); if a=1 then MsgBox('Cancel button image exists') else MsgBox('The image does not exist'); Cycles: operators FOR and UNTIL The for and until operators are also available: a:=0; // this example will count using MsgBox from
1 to 3 using until operator is a good idea to wait for some image to appear. For instance, when it is necessary to check the list of some items, script can move mouse to the first element of the list and then use keyboard to move and MouseFocuse function to check if necessary item exists in the list. The function below will show how to manage this with iTestBot:
// depending on the category we are looking for we
check the necessary image for existance // if the category was found we click on it Uses command to include stand alone unit |
|
In the style of Pascal one can include external unit into the project.
Here is as example: Unit Sample; function main : Integer; |