Skip to content

Robot Language

Robot Framework Language

Example with different Robot Framework language constructs.

Visit https://robocorp.com/docs-robot-framework/languages-and-frameworks/robot-framework for more information.

1 failed, 32 passed, 0 skiped, 33 total
Executed in 125 ms on March 17, 2024 at 11:53:00
Source /home/chme/git/python-robot-markdown/examples/Robot_Language

Statistics

Pass / Fail / Skip Total / Elapsed
FAIL Robot Language 32 / 1 / 0 33 / 125 ms
PASS Robot Language.For Loop 8 / 0 / 0 8 / 34 ms
PASS Robot Language.If Else 8 / 0 / 0 8 / 27 ms
PASS Robot Language.Try Except Finally 12 / 0 / 0 12 / 22 ms
FAIL Robot Language.While Loop 4 / 1 / 0 5 / 21 ms

For Loop PASS

Example test cases with FOR loops

0 fail, 8 pass, 0 skip, 8 total
Executed in 34 ms

Loop a list PASS

Executed in 4 ms

Log ${LIST}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO ['one', 'two', 'three']

FOR ${item} IN [ @{LIST} ]

Executed in 1 ms

ITERATION ${item} = one

Executed in 1 ms

Log ${item}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO one

ITERATION ${item} = two

Executed in 0 ms

Log ${item}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO two

ITERATION ${item} = three

Executed in 0 ms

Log ${item}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO three

FOR ${item} IN [ one two three ]

Executed in 1 ms

ITERATION ${item} = one

Executed in 0 ms

Log ${item}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO one

ITERATION ${item} = two

Executed in 0 ms

Log ${item}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO two

ITERATION ${item} = three

Executed in 1 ms

Log ${item}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO three

INFO ['one', 'two', 'three']
INFO one
INFO two
INFO three
INFO one
INFO two
INFO three

Loop a dictionary PASS

Executed in 4 ms

Log ${DICTIONARY}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO {'string': 'cat', 'number': 1, 'list': ['one', 'two', 'three']}

FOR ${key_value_tuple} IN [ &{DICTIONARY} ]

Executed in 1 ms

ITERATION ${key_value_tuple} = ('string', 'cat')

Executed in 0 ms

Log ${key_value_tuple}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO ('string', 'cat')

ITERATION ${key_value_tuple} = ('number', 1)

Executed in 1 ms

Log ${key_value_tuple}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO ('number', 1)

ITERATION ${key_value_tuple} = ('list', ['one', 'two', 'three'])

Executed in 0 ms

Log ${key_value_tuple}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO ('list', ['one', 'two', 'three'])

FOR ${key} IN [ @{DICTIONARY} ]

Executed in 2 ms

ITERATION ${key} = string

Executed in 1 ms

Log ${key}=${DICTIONARY}[${key}]

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO string=cat

ITERATION ${key} = number

Executed in 0 ms

Log ${key}=${DICTIONARY}[${key}]

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO number=1

ITERATION ${key} = list

Executed in 1 ms

Log ${key}=${DICTIONARY}[${key}]

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO list=['one', 'two', 'three']

INFO {'string': 'cat', 'number': 1, 'list': ['one', 'two', 'three']}
INFO ('string', 'cat')
INFO ('number', 1)
INFO ('list', ['one', 'two', 'three'])
INFO string=cat
INFO number=1
INFO list=['one', 'two', 'three']

Loop a range from 0 to end index PASS

Executed in 4 ms

FOR ${index} IN RANGE [ 10 ]

Executed in 4 ms

ITERATION ${index} = 0

Executed in 1 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 0

ITERATION ${index} = 1

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 1

ITERATION ${index} = 2

Executed in 1 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO 2

ITERATION ${index} = 3

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 3

ITERATION ${index} = 4

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 4

ITERATION ${index} = 5

Executed in 1 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO 5

ITERATION ${index} = 6

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 6

ITERATION ${index} = 7

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 7

ITERATION ${index} = 8

Executed in 1 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 8

ITERATION ${index} = 9

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 9

INFO 0
INFO 1
INFO 2
INFO 3
INFO 4
INFO 5
INFO 6
INFO 7
INFO 8
INFO 9

Loop a range from start to end index PASS

Executed in 3 ms

FOR ${index} IN RANGE [ 1 10 ]

Executed in 3 ms

ITERATION ${index} = 1

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 1

ITERATION ${index} = 2

Executed in 1 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO 2

ITERATION ${index} = 3

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 3

ITERATION ${index} = 4

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 4

ITERATION ${index} = 5

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 5

ITERATION ${index} = 6

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 6

ITERATION ${index} = 7

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 7

ITERATION ${index} = 8

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 8

ITERATION ${index} = 9

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 9

INFO 1
INFO 2
INFO 3
INFO 4
INFO 5
INFO 6
INFO 7
INFO 8
INFO 9

Loop a range from start to end index with steps PASS

Executed in 2 ms

FOR ${index} IN RANGE [ 0 10 2 ]

Executed in 2 ms

ITERATION ${index} = 0

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 0

ITERATION ${index} = 2

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 2

ITERATION ${index} = 4

Executed in 1 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO 4

ITERATION ${index} = 6

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 6

ITERATION ${index} = 8

Executed in 0 ms

Log ${index}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 8

INFO 0
INFO 2
INFO 4
INFO 6
INFO 8

Nest loops PASS

Executed in 6 ms

@{alphabets} = Create List a b c

Returns a list containing given items.

BuiltIn.Create List
Executed in 0 ms

INFO @{alphabets} = [ a | b | c ]

Log ${alphabets}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO ['a', 'b', 'c']

@{numbers} = Create List ${1} ${2} ${3}

Returns a list containing given items.

BuiltIn.Create List
Executed in 0 ms

INFO @{numbers} = [ 1 | 2 | 3 ]

Log ${numbers}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO [1, 2, 3]

FOR ${alphabet} IN [ @{alphabets} ]

Executed in 4 ms

ITERATION ${alphabet} = a

Executed in 1 ms

FOR ${number} IN [ @{numbers} ]

Executed in 1 ms

ITERATION ${number} = 1

Executed in 0 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO a1

ITERATION ${number} = 2

Executed in 1 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO a2

ITERATION ${number} = 3

Executed in 0 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO a3

ITERATION ${alphabet} = b

Executed in 2 ms

FOR ${number} IN [ @{numbers} ]

Executed in 1 ms

ITERATION ${number} = 1

Executed in 1 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO b1

ITERATION ${number} = 2

Executed in 0 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO b2

ITERATION ${number} = 3

Executed in 0 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO b3

ITERATION ${alphabet} = c

Executed in 1 ms

FOR ${number} IN [ @{numbers} ]

Executed in 1 ms

ITERATION ${number} = 1

Executed in 0 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO c1

ITERATION ${number} = 2

Executed in 0 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO c2

ITERATION ${number} = 3

Executed in 1 ms

Log ${alphabet}${number}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO c3

INFO @{alphabets} = [ a | b | c ]
INFO ['a', 'b', 'c']
INFO @{numbers} = [ 1 | 2 | 3 ]
INFO [1, 2, 3]
INFO a1
INFO a2
INFO a3
INFO b1
INFO b2
INFO b3
INFO c1
INFO c2
INFO c3

Exit a loop on condition PASS

Executed in 4 ms

FOR ${i} IN RANGE [ 5 ]

Executed in 2 ms

ITERATION ${i} = 0

Executed in 1 ms

IF ${i} == 2

Executed in 0 ms

BREAK

Executed in 0 ms

Log ${i}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO 0

ITERATION ${i} = 1

Executed in 1 ms

IF ${i} == 2

Executed in 0 ms

BREAK

Executed in 0 ms

Log ${i}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO 1

ITERATION ${i} = 2

Executed in 0 ms

IF ${i} == 2

Executed in 0 ms

BREAK

Executed in 0 ms

Log ${i}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 0
INFO 1

Continue a loop from the next iteration on condition PASS

Executed in 3 ms

FOR ${i} IN RANGE [ 3 ]

Executed in 2 ms

ITERATION ${i} = 0

Executed in 1 ms

IF ${i} == 1

Executed in 1 ms

CONTINUE

Executed in 0 ms

Log ${i}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 0

ITERATION ${i} = 1

Executed in 1 ms

IF ${i} == 1

Executed in 0 ms

CONTINUE

Executed in 0 ms

Log ${i}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ITERATION ${i} = 2

Executed in 0 ms

IF ${i} == 1

Executed in 0 ms

CONTINUE

Executed in 0 ms

Log ${i}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO 2

INFO 0
INFO 2

If Else PASS

Example test cases with IF conditions

0 fail, 8 pass, 0 skip, 8 total
Executed in 27 ms

Use IF construct in Robot Framework PASS

Executed in 6 ms

IF ${True}

Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO This line IS executed.

IF ${False}

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

IF "cat" == "cat"

Executed in 0 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

IF "cat" != "dog"

Executed in 0 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

IF "cat" == "dog"

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

IF "cat" == "cat" and "dog" == "dog"

Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

IF "cat" == "cat" and "dog" == "cat"

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

IF 1 == 1

Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO This line IS executed.

IF 2 < 1

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

IF 2 <= 2

Executed in 0 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

IF len("cat") == 3

Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

IF (1 == 1 and 2 == 2) and 3 == 3

Executed in 0 ms

Log This line IS executed since the expressions evaluate to True.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed since the expressions evaluate to True.

IF (1 == 2 or 3 == 4) or 3 == 3

Executed in 1 ms

Log This line IS executed since one of the expressions evaluates to True.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed since one of the expressions evaluates to True.

INFO This line IS executed.
INFO This line IS executed.
INFO This line IS executed.
INFO This line IS executed.
INFO This line IS executed.
INFO This line IS executed.
INFO This line IS executed.
INFO This line IS executed since the expressions evaluate to True.
INFO This line IS executed since one of the expressions evaluates to True.

Use inline IF construct in Robot Framework PASS

Executed in 1 ms

IF "cat" == "cat"

Executed in 1 ms

Log This is logged.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO This is logged.

ELSE

Executed in 0 ms

Log This is NOT logged.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This is logged.

Use IF / ELSE construct in Robot Framework PASS

Executed in 2 ms

IF 1 == 1

Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

ELSE

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

IF 1 == 2

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ELSE

Executed in 0 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

INFO This line IS executed.
INFO This line IS executed.

Use IF / ELSE IF construct in Robot Framework PASS

Executed in 2 ms

IF 1 == 1

Executed in 0 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

ELSE IF 2 == 2

Executed in 1 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

IF 1 == 2

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ELSE IF 2 == 2

Executed in 0 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

IF 1 == 2

Executed in 1 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

ELSE IF 2 == 3

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.
INFO This line IS executed.

Use IF / ELSE IF / ELSE construct in Robot Framework PASS

Executed in 3 ms

IF 1 == 1

Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

ELSE IF 2 == 2

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ELSE

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

IF 1 == 2

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ELSE IF 2 == 2

Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO This line IS executed.

ELSE

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

IF 1 == 2

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ELSE IF 2 == 3

Executed in 0 ms

Log This line is NOT executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ELSE

Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO This line IS executed.

INFO This line IS executed.
INFO This line IS executed.
INFO This line IS executed.

Use Run Keyword If in Robot Framework PASS

Executed in 1 ms

Run Keyword If ${True} Log This line IS executed.

Runs the given keyword with the given arguments, if condition is true.

BuiltIn.Run Keyword If
Executed in 1 ms

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

Run Keyword If ${False} Log This line is NOT executed.

Runs the given keyword with the given arguments, if condition is true.

BuiltIn.Run Keyword If
Executed in 0 ms

INFO This line IS executed.

Use Run Keyword Unless in Robot Framework PASS

Executed in 1 ms

Run Keyword Unless ${True} Log This line is NOT executed.

DEPRECATED since RF 5.0. Use Native IF/ELSE or Run Keyword If instead.

BuiltIn.Run Keyword Unless
Executed in 0 ms

WARN Keyword 'BuiltIn.Run Keyword Unless' is deprecated. 

Run Keyword Unless ${False} Log This line IS executed.

DEPRECATED since RF 5.0. Use Native IF/ELSE or Run Keyword If instead.

BuiltIn.Run Keyword Unless
Executed in 1 ms

WARN Keyword 'BuiltIn.Run Keyword Unless' is deprecated. 

Log This line IS executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO This line IS executed.

WARN Keyword 'BuiltIn.Run Keyword Unless' is deprecated. 
WARN Keyword 'BuiltIn.Run Keyword Unless' is deprecated. 
INFO This line IS executed.

Execute a for loop only three times PASS

Executed in 6 ms

FOR ${robot} IN [ @{ROBOTS} ]

Executed in 6 ms

ITERATION ${robot} = Bender

Executed in 4 ms

IF $robot == 'Terminator'

Executed in 3 ms

CONTINUE

Executed in 0 ms

Log ${robot}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Bender

ITERATION ${robot} = Johnny5

Executed in 1 ms

IF $robot == 'Terminator'

Executed in 0 ms

CONTINUE

Executed in 0 ms

Log ${robot}

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Johnny5

ITERATION ${robot} = Terminator

Executed in 0 ms

IF $robot == 'Terminator'

Executed in 0 ms

CONTINUE

Executed in 0 ms

Log ${robot}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ITERATION ${robot} = Robocop

Executed in 1 ms

IF $robot == 'Terminator'

Executed in 1 ms

CONTINUE

Executed in 0 ms

Log ${robot}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Robocop

INFO Bender
INFO Johnny5
INFO Robocop

Try Except Finally PASS

Example test cases with TRY EXCEPT FINALLY

0 fail, 12 pass, 0 skip, 12 total
Executed in 22 ms

TRY / EXCEPT: Catch any exception PASS

Executed in 2 ms

TRY

Executed in 0 ms

Fail

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL AssertionError

EXCEPT

Executed in 1 ms

Log EXCEPT with no arguments catches any exception.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO EXCEPT with no arguments catches any exception.

FAIL AssertionError
INFO EXCEPT with no arguments catches any exception.

TRY / EXCEPT: Catch an exception by exact message PASS

Executed in 2 ms

TRY

Executed in 0 ms

Fail Error message

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL Error message

EXCEPT Error message

Executed in 1 ms

Log Catches only "Error message" exceptions.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Catches only "Error message" exceptions.

Log Enables error-specific exception handling.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Enables error-specific exception handling.

FAIL Error message
INFO Catches only "Error message" exceptions.
INFO Enables error-specific exception handling.

TRY / EXCEPT: Multiple EXCEPT statements PASS

Executed in 2 ms

TRY

Executed in 0 ms

Fail Error message

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL Error message

EXCEPT Another error message

Executed in 0 ms

Log Catches only "Another error message" exceptions.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

EXCEPT Error message

Executed in 1 ms

Log Catches the "Error message" exception.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Catches the "Error message" exception.

FAIL Error message
INFO Catches the "Error message" exception.

TRY / EXCEPT: Multiple messages in EXCEPT statement PASS

Executed in 1 ms

TRY

Executed in 1 ms

Fail CCC

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 1 ms

FAIL CCC

EXCEPT AAA BBB CCC

Executed in 0 ms

Log Catches any "AAA", "BBB", or "CCC" exception.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Catches any "AAA", "BBB", or "CCC" exception.

FAIL CCC
INFO Catches any "AAA", "BBB", or "CCC" exception.

TRY / EXCEPT: Catch a specific exception, or an unexpected exception PASS

Executed in 1 ms

TRY

Executed in 0 ms

Fail Error message

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL Error message

EXCEPT Another message

Executed in 0 ms

Log Catches only "Another message" exceptions.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

EXCEPT

Executed in 1 ms

Log Catches any exception.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Catches any exception.

Log Useful for handling unexpected exceptions.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Useful for handling unexpected exceptions.

FAIL Error message
INFO Catches any exception.
INFO Useful for handling unexpected exceptions.

TRY / EXCEPT: Catch exceptions where the message starts with PASS

Executed in 1 ms

TRY

Executed in 0 ms

Fail A long error message with lots of details

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL A long error message with lots of details

EXCEPT A long error message type=start

Executed in 1 ms

Log Matches the start of an error message.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Matches the start of an error message.

FAIL A long error message with lots of details
INFO Matches the start of an error message.

TRY / EXCEPT: Capture the error message PASS

Executed in 1 ms

TRY

Executed in 1 ms

Fail Goodbye, world!

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 1 ms

FAIL Goodbye, world!

EXCEPT

Executed in 0 ms

Log ${error_message}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Goodbye, world!

FAIL Goodbye, world!
INFO Goodbye, world!

TRY / EXCEPT: Using ELSE when no exceptions occured PASS

Executed in 2 ms

TRY

Executed in 0 ms

Log All good!

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO All good!

EXCEPT Error message

Executed in 0 ms

Log An error occured.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ELSE

Executed in 1 ms

Log No error occured.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO No error occured.

INFO All good!
INFO No error occured.

TRY / EXCEPT / FINALLY: Always execute code no matter if exceptions or not PASS

Executed in 2 ms

TRY

Executed in 1 ms

Log All good!

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO All good!

FINALLY

Executed in 0 ms

Log FINALLY is always executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO FINALLY is always executed.

TRY

Executed in 0 ms

Fail Catastrophic failure!

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL Catastrophic failure!

EXCEPT

Executed in 1 ms

Log Catches any exception.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Catches any exception.

FINALLY

Executed in 0 ms

Log FINALLY is always executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO FINALLY is always executed.

INFO All good!
INFO FINALLY is always executed.
FAIL Catastrophic failure!
INFO Catches any exception.
INFO FINALLY is always executed.

TRY / EXCEPT / ELSE / FINALLY: All together! PASS

Executed in 2 ms

TRY

Executed in 0 ms

Fail Error message

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL Error message

EXCEPT

Executed in 0 ms

Log Executed if any exception occurs.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed if any exception occurs.

ELSE

Executed in 1 ms

Log Executed if no exceptions occur.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

FINALLY

Executed in 0 ms

Log FINALLY is always executed.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO FINALLY is always executed.

FAIL Error message
INFO Executed if any exception occurs.
INFO FINALLY is always executed.

TRY / EXCEPT: Glob pattern matching PASS

Executed in 2 ms

TRY

Executed in 0 ms

Fail My error: 99 occured

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL My error: 99 occured

EXCEPT My error: * type=glob

Executed in 0 ms

Log Catches by glob pattern matching.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Catches by glob pattern matching.

FAIL My error: 99 occured
INFO Catches by glob pattern matching.

TRY / EXCEPT: Regular expression matching PASS

Executed in 1 ms

TRY

Executed in 0 ms

Fail error 99 occured

Fails the test with the given message and optionally alters its tags.

BuiltIn.Fail
Executed in 0 ms

FAIL error 99 occured

EXCEPT [Ee]rror \\d+ occured type=regexp

Executed in 0 ms

Log Catches by regular expression pattern matching.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Catches by regular expression pattern matching.

FAIL error 99 occured
INFO Catches by regular expression pattern matching.

While Loop FAIL

Example test cases with WHILE loops

1 fail, 4 pass, 0 skip, 5 total
Executed in 21 ms

WHILE: A simple while loop using the default loop limit FAIL

Executed in 4 ms

WHILE loop was aborted because it did not finish within the limit of 10 iterations. Use the 'limit' argument to increase or remove the limit if needed.

WHILE True limit=10

Executed in 3 ms

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 1 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 1 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 1 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.

WHILE: Loop while the given limit is hit PASS

Executed in 5 ms

TRY

Executed in 4 ms

WHILE True limit=10

Executed in 4 ms

ITERATION

Executed in 1 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 1 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 1 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 1 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Executed until the given loop limit (10) is hit.

ITERATION

Executed in 0 ms

Log Executed until the given loop limit (10) is hit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed until the given loop limit (10) is hit.

EXCEPT WHILE loop was aborted type=start

Executed in 1 ms

Log The loop did not finish within the limit.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO The loop did not finish within the limit.

INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO Executed until the given loop limit (10) is hit.
INFO The loop did not finish within the limit.

WHILE: Loop while condition evaluates to True or the default loop limit is hit PASS

Executed in 4 ms

${x} = Set Variable ${0}

Returns the given values which can then be assigned to a variables.

BuiltIn.Set Variable
Executed in 0 ms

INFO ${x} = 0

WHILE ${x} < 3

Executed in 3 ms

ITERATION

Executed in 2 ms

Log Executed as long as the condition is True.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed as long as the condition is True.

${x} = Evaluate ${x} + 1

Evaluates the given expression in Python and returns the result.

BuiltIn.Evaluate
Executed in 1 ms

INFO ${x} = 1

ITERATION

Executed in 0 ms

Log Executed as long as the condition is True.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO Executed as long as the condition is True.

${x} = Evaluate ${x} + 1

Evaluates the given expression in Python and returns the result.

BuiltIn.Evaluate
Executed in 0 ms

INFO ${x} = 2

ITERATION

Executed in 1 ms

Log Executed as long as the condition is True.

Logs the given message with the given level.

BuiltIn.Log
Executed in 1 ms

INFO Executed as long as the condition is True.

${x} = Evaluate ${x} + 1

Evaluates the given expression in Python and returns the result.

BuiltIn.Evaluate
Executed in 0 ms

INFO ${x} = 3

INFO ${x} = 0
INFO Executed as long as the condition is True.
INFO ${x} = 1
INFO Executed as long as the condition is True.
INFO ${x} = 2
INFO Executed as long as the condition is True.
INFO ${x} = 3

WHILE: Skip a loop iteration with CONTINUE PASS

Executed in 4 ms

${x} = Set Variable ${0}

Returns the given values which can then be assigned to a variables.

BuiltIn.Set Variable
Executed in 0 ms

INFO ${x} = 0

WHILE ${x} < 3

Executed in 3 ms

ITERATION

Executed in 1 ms

${x} = Evaluate ${x} + 1

Evaluates the given expression in Python and returns the result.

BuiltIn.Evaluate
Executed in 0 ms

INFO ${x} = 1

IF ${x} == 2

Executed in 0 ms

CONTINUE

Executed in 0 ms

Log x = ${x}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO x = 1

ITERATION

Executed in 1 ms

${x} = Evaluate ${x} + 1

Evaluates the given expression in Python and returns the result.

BuiltIn.Evaluate
Executed in 1 ms

INFO ${x} = 2

IF ${x} == 2

Executed in 0 ms

CONTINUE

Executed in 0 ms

Log x = ${x}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

ITERATION

Executed in 1 ms

${x} = Evaluate ${x} + 1

Evaluates the given expression in Python and returns the result.

BuiltIn.Evaluate
Executed in 1 ms

INFO ${x} = 3

IF ${x} == 2

Executed in 0 ms

CONTINUE

Executed in 0 ms

Log x = ${x}

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms

INFO x = 3

INFO ${x} = 0
INFO ${x} = 1
INFO x = 1
INFO ${x} = 2
INFO ${x} = 3
INFO x = 3

WHILE: Exit loop with BREAK PASS

Executed in 0 ms

WHILE True

Executed in 0 ms

ITERATION

Executed in 0 ms

BREAK

Executed in 0 ms

Log This will not be logged.

Logs the given message with the given level.

BuiltIn.Log
Executed in 0 ms