Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

robotframework - In robot framework is there a method to print the variable value of the embedded argument in keyword rather than the variable name?

*** keywords ***
Do something on ${var1} and ${var2}
    Log ${var1} 
    Log ${var2}

*** Test Cases ***
Testing
    ${id1}  Set Variable    variable1
    ${id2}  Set Variable    variable2
    Do something on ${id1} and ${id2}

When we run the above robot testcase the logs display ${id1} and ${id2} as variables in the keyword.

KEYWORD ${id1} = BuiltIn . Set Variable variable1
KEYWORD ${id2} = BuiltIn . Set Variable variable2
KEYWORD Do something on ${id1} and ${id2}

Is it possible in robot to have the log print the value of the variable instead of the variable itself in such use case, where the embedded arguments are variables?

For example can we have log print

KEYWORD Do something on variable1 and variable2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sometimes its worthy to read the official documentation.

Log To Console - https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Log%20To%20Console

Also, you have Log ${var1} and it should be Log ${var1} (more than one space acts as separator)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...