Skip to content

Instantly share code, notes, and snippets.

@apallier
apallier / var_syntax.robot
Created November 30, 2023 21:20
Robot Framework 7.0 VAR syntax
*** Test Cases ***
Scalar examples
VAR ${simple} variable
VAR ${equals} = this works too
VAR ${variable} value contains ${simple}
VAR ${sentence} This is a bit longer variable value
... that is split into multiple rows.
... These parts are joined with a space.
VAR ${multiline} This is another longer value.
... This time there is a custom separator.
@apallier
apallier / robotframework_presets.md
Created February 8, 2023 21:31
Robot Framework: inject variables/presets methods

Method 1

robot --variable VARIABLE:value

Method 2

*** Settings ***
@apallier
apallier / datetime_timer_string.robot
Created October 21, 2022 06:54
Robot Framework: timer string
*** Test Cases ***
Examples With Timer String
[Documentation] Examples of timer format
Should Video Duration Equal 01:05:45 ${video_file_path}
Should Ads Inserted from=15:05 to=16:50 ${video_file_path}
Sleep 01:00 # 1min pause
Should Video Color Start at=01:16:50.005 color=green ${video_file_path}
Should Video Color End at=01:17:01.102 color=green ${video_file_path}
@apallier
apallier / datetime_time_string.robot
Created October 18, 2022 17:57
Robot Framework: time string
*** Variables ***
${TIME_1} 1 min 30 secs
${TIME_2} 1.5 minutes
${TIME_3} 90 s
${TIME_4} 1 day 2 hours 3 minutes 4 seconds 5 milliseconds
${TIME_5} 1d 2h 3m 4s 5ms
${TIME_6} - 10 seconds
@apallier
apallier / datetime_date.robot
Last active October 20, 2022 18:23
Robot Framework: date management with DateTime library
*** Settings ***
Library DateTime
Library Browser
*** Test Cases ***
Examples With Date
[Documentation] Examples of date format
${date}= Convert Date 1985-08-05 09:01:30
${date}= Convert Date 19850805 090130
@apallier
apallier / almost_equal.robot
Created September 25, 2022 19:49
Robot Framework: check whether two given values are almost equal or not
*** Keywords ***
Should Be Almost Equal
[Documentation] Check whether two given values are almost equal or not.
[Arguments] ${expected} ${actual} ${delta}
Should Be True abs(${expected} - ${actual}) < ${delta}