Could you tell me about how to get the variable type in Robot Framework.
${ABC} Set Variable Test
${XYZ} Set Variable 1233
Remark: Get the variable Type such as string, int
get ${ABC} type = string
get ${XYZ} type = int
By default all variables created with Set Variable are strings - if you typed ${variable} Set Variable 123 , the type of that variable is going to be string - a string with the value "123", which though looks like a number is really a string (you can do Fetch From Left on it, for example).
There are three types of variables supported in robot framework − scalar, list and dictionary.
Enter the argument to be used with the keyword. Go back to your test case. Now, you need to pass the value which is the URL to be used for the test case. In the test case, when you type the user-defined keyword and press Ctrl + Spacebar, it gives the details of the keyword along with the arguments.
There is no support in robot for getting the current keyword name. Since the code you're writing must be run from a keyword, your keyword should know what its own name is.
This is what I use:
${type} = Evaluate type($temp).__name__
Note: it's good to have global string/int/float/list/dict/... examples for comparison than hard-coding the type values as they might differ depending on build.
You can do e.g. this:
${type_ABC} Evaluate type($ABC)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With