寻找一种如何在Robot Framework中表示模数/绝对值的方法.是abs()吗?或$ {variable} .abs()?如何将负值为-15的$ {variable}设为+15
像这样:| -15 | = 15
小智 12
您需要使用Evaluate关键字为您的号码运行abs函数:
*** Variables ***
${neg num} -15
*** Test Cases ***
Absolute
Log ${neg num}
${num}= Evaluate abs(${neg num})
Run Code Online (Sandbox Code Playgroud)
小智 5
如果您需要 Pekka 完美最佳答案的替代方案,那就是:
*** Variables ***
${var} -15
*** Test Cases ***
Absolute
Log ${var}
${abs var}= Set Variable ${var.__abs__()}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2966 次 |
| 最近记录: |