首页 > 解决方案 > 模板关键字无法处理 RF 3.2.1 中的换行符

问题描述

这个测试用例如果在 Robot Framework 3.1.2 中工作正常但在 3.2.1 中我收到错误消息:

设置“模板”只接受一个值,得到 2。

我看不到解释这一点的文档有任何更新。有任何想法吗?

*** Test Cases ***
Test Case
    [Template]    The result of ${calculation}
    ...           should be ${expected}
    1 + 1    2
    2 + 2    4

*** Keywords ***
The result of ${calculation} should be ${expected}
    ${result} =    Evaluate    ${calculation}
    Should Be Equal As Integers    ${result}     ${expected}

标签: robotframework

解决方案


...标记参数边界。您所做的与此完全相同:

[Template]    The result of ${calculation}    should be ${expected}

就像错误所说的那样,该[Template]设置只接受一个参数,但您传递了两个参数。您不能在多行上定义关键字。

看来旧的(3.2 之前的)解析器可能有点松懈,允许您将模板关键字拆分为多行。新的解析器不允许这样做。


推荐阅读