Get Type in Robot Framework

半世苍凉 提交于 2020-01-14 02:30:07

问题


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


回答1:


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.




回答2:


You can do e.g. this: ${type_ABC} Evaluate type($ABC)



来源:https://stackoverflow.com/questions/42617970/get-type-in-robot-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!