【问题标题】:robot framework - BDD dependency between Given When Then机器人框架 - Given When Then 之间的 BDD 依赖关系
【发布时间】:2021-08-13 06:39:51
【问题描述】:

我最近开始使用机器人框架进行 api 测试开发。小黄瓜对我来说是全新的。

如何管理 Given 与 When 和 Then 之间的依赖关系?例如: 如果我这么说

Given create account is successful ( which may have the ability to return account no)
When I update my address (this keyword needs the account no set by Given)
Then account should be updated. 

现在对于何时成功工作,它应该知道帐户 ID 或交易 ID 或 Given 创建的类似内容。 Given 将如何将数据传递给 When 等等。

这些关键字之间的数据如何保持不变?我没有看到任何示例或 BDD 不适用于此类示例?如果有相关链接,请参考我。

【问题讨论】:

    标签: robotframework gherkin


    【解决方案1】:

    您的关键字可以使用set test variable 将数据存储在测试变量中。测试变量对测试期间运行的所有关键字都是可见的。

    有关更多信息,请参阅机器人框架用户指南中的Using Set Test/Suite/Global Variable keywords

    例如,

    *** Keywords ***
    create account is successful
        ${account number}=  Create the account  
        set test variable  ${account number}  
    

    【讨论】:

    • 谢谢。这很有帮助
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多