Skip to content

Instantly share code, notes, and snippets.

@laojala
Last active November 14, 2022 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save laojala/4bb26f69495c9ca639ea2ac6ead9d5f1 to your computer and use it in GitHub Desktop.
Save laojala/4bb26f69495c9ca639ea2ac6ead9d5f1 to your computer and use it in GitHub Desktop.
Evaluates if variable passed from command line is Boolean type
*** Settings ***
Documentation Evaluates if variable passed from command line is Boolean type
... Requires Robot Framework version 3.2 or newer
... Arguments are passed for a test like this:
... robot --variable MY_BOOLEAN:False path/to/this/file
... Tests pass both for "True" and "False" and should fail for any other inputs.
*** Variables ***
${MY_BOOLEAN} not boolean - tests fail with this
*** Test Cases ***
Variable Type Should Be Boolean
${is_boolean} Evaluate type(${MY_BOOLEAN}) == bool
Should Be True ${is_boolean}
Variable Type Should Be Boolean - Python Inline Evaluation
[Documentation] Uses Python Inline Evaluation
... Testing same thing as "Variable Should Be True"
Should Be True ${{ type(${MY_BOOLEAN}) == bool }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment