concordion assertEquals限制

时间:2015-03-26 05:06:25

标签: concordion

assertEquals 的Concordion版本允许将方法返回值与HTML元素内部值进行比较,例如

p concordion:assertEquals =“getGreeting()”> Hello World!

然而,在许多情况下,期望值是在测试执行期间动态生成的,并且事先不知道。在这种情况下如何使用Concordion assertEquals?如何将期望值传递给assertEquals?

2 个答案:

答案 0 :(得分:0)

Concordion小组回答了类似的问题: https://groups.google.com/forum/#!topic/concordion/9hkcXCgwqWU

答案对你有帮助吗? 如果没有,你还需要什么?

答案 1 :(得分:0)

上一个答案中引用的thread的最终解决方案:

HTML:

<span concordion:execute="#result = getResults()"></span>
<p><span concordion:assertTrue="#result.matches">They match!</span>
Primary email is: <span concordion:echo="#result.primaryEmail"></span>
Secondary email is: <span concordion:echo="#result.secondaryEmail">
</span></p>

夹具:

import static org.concordion.api.MultiValueResult.multiValueResult;

public MultiValueResult getResults() {
    return multiValueResult()
            .with("primaryEmail", "t...@tfwright.co.nz")
            .with("secondaryEmail", "t...@tfwright.co.nz")
            .with("matches", true);
}