Script Language
DescriptionThe Script Language is a lightweight, C-like scripting language designed for automated testing and system interaction.
It supports typed variables, conditional logic, functions, and integration with predefined automation methods (e.g., Pass, Fail, Execute).
Scripts are executed line by line, with clear syntax and structured blocks using curly braces.
Key Features
- Strongly typed variables (bool, int, float, string, etc.)
- Conditional logic with if / else statements
- Multi-branch selection using switch / case / default / break
- Loop constructs: while, do...while, and for
- Function definitions with return values
- Built-in methods for test verification and result reporting
- Automatic type checking and expression evaluation
- Simple syntax similar to C / C++ for easy readability
Supported Data Types
- void - No return value (used for main or utility functions)
- bool - Boolean values (true / false)
- uint8_t - 8-bit unsigned integer (0-255)
- int8 - 8-bit signed integer (-128-127)
- int - Standard integer type
- float - Floating-point number
- string - Unicode text
Control Flow
- if and else statements allow conditional branching based on logical expressions.
- switch statements allow multi-way branching based on the value of an expression.
Each case represents a possible value to match, and break ends the execution of a case.
default is executed if no case matches.
- while loops repeatedly execute a block of code as long as the condition evaluates to true.
The break keyword can be used to exit the loop prematurely.
- do...while loops execute the body at least once, then repeat as long as the condition evaluates to true.
The condition is checked after each iteration. The break keyword can be used to exit the loop prematurely.
- for loops provide a compact loop with initialization, condition, and increment expressions: for (init; condition; increment).
All three parts are optional. An empty condition is treated as always true (e.g., for(;;) creates an infinite loop).
The break keyword can be used to exit the loop prematurely.
- Curly braces are required to define code blocks.
Operators
- Arithmetic: +, -, *, /
- Comparison: ==, !=, <, <=, >, >=
- Logical: !, &&, ||
Special Keywords
- return - Return a value from a function.
- true, false - Boolean constants.
- switch, case, default, break - Multi-branch control flow.
- while, do, for - Loop constructs.
Functions
Functions are declared using a return type, a name, and parentheses with optional parameters.
Each script must contain a main() function as its entry point.
Example
void main()
{
string name = "World";
if (name == "World")
{
Pass("Hello " + name);
}
else
{
Fail("Unexpected value");
}
int value = 2;
switch(value)
{
case 1:
Pass("Value is 1");
break;
case 2:
Pass("Value is 2");
break;
default:
Fail("Value is unknown");
}
// do...while loop
int x = 0;
do
{
Print(x);
x++;
}
while (x < 3);
// Output: 0, 1, 2
// for loop
for (int i = 0; i < 5; i++)
{
Print(i);
}
// Output: 0, 1, 2, 3, 4
}
Typical Use Cases
- Automated GUI testing
- Verifying functional behavior of desktop applications
- Running command-line based system tests
- Creating reusable test logic via user-defined functions
Notes
- Script execution always begins in void main().
- Most automation-related methods (e.g., mouse or keyboard functions) require an active AUT (Application Under Test).
- Scripts stop immediately after calling Fail() or Pass().
- The language is case-sensitive.