【发布时间】:2017-06-28 08:51:15
【问题描述】:
根据user guide,可以为变量赋值,然后执行简单的算术运算。
想象一下,我设计了一个夹具,用于获取页面上的一个元素并将数值提取为 Double(我现在使用 HSAC Slim BrowserTest 夹具和我自己的代码来执行此操作)
|script |numbers extraction |
|$testval1=|numeric value of |element1 | |
|$testval2=|numeric value of |element2 | |
运行它会给我类似的东西:
|script |numbers extraction |
|$testval1<-[20.04]|numeric value of |element1 ->[€ 20,04] | |
|$testval2<-[5.1] |numeric value of |element2 ->[€ 5,1] | |
现在说我想将两个双精度数的总和与第三个元素的数值进行比较:
|script|numbers extraction |
|check |numeric value of |element3|{=${ ${testval1} + ${testval2} =}|
无论我在最后一个单元格中使用哪种括号和美元符号组合,我总是得到“无效的表达式”。
- ${= $testval1 + $testval2 =} 无效表达式:$testval1 + $testval2
- {${=$testval1 + $testval2 =}} {无效表达式:$testval1 + $testval2}
- ${=${testval1} + ${testval2} =} [无效表达式:未定义变量:testval1 + 未定义变量:testval2]
- ${= !-$testval1-! + !-$testval2-! =} 无效表达式:$testval1 + $testval2
- ${= !-${testval1}-! + !-${testval2}-! =} 无效表达式:${testval1} + ${testval2}
运行最后一行(testval1 和 testval2 周围没有括号)返回:
|check|numeric value of|element3 ->[€ 25.14]| [25.14] expected [invalid expression: $testval1->[20.04] + $testval2->[5.1]] |
【问题讨论】:
标签: fitnesse acceptance-testing