【问题标题】:For data driven test using robotframework, is it possible to have more than one data driver (using more than one datasheet)?对于使用机器人框架的数据驱动测试,是否可以有多个数据驱动程序(使用多个数据表)?
【发布时间】:2022-01-16 17:38:46
【问题描述】:

我目前正在进行数据驱动的测试。我创建了一个测试模板,它将使用来自一个 excel 文件(特定工作表)的数据作为输入数据。是否可以从一个机器人文件中的多个 Excel 表中导入数据?

【问题讨论】:

    标签: python-3.x automation robotframework data-driven-tests


    【解决方案1】:

    是的,这是可能的。使用 for 循环逐个搜索多个文件。 您可以使用以下内容:f1、f2、f3 等。

    `with open(filepath, 'r') as f1:

    lines = f.readlines()

    换行:

    #做某事`

    【讨论】:

    • 机器人框架能做到这一点吗?
    • 是的,您可以将 python 代码作为库添加到您的设置区域。使用 Run/Start Process pythonprogname 在机器人中调用该函数,更多详细信息位于 - robotframework.org/robotframework/latest/libraries/…
    • 所以你建议在robotframework中使用python脚本而不是数据驱动程序?我的测试用例在测试模板中。
    • 基本上我想要的是我导入一个带有多个数据表的 xlsx 文件,我想要不同的测试用例使用来自不同数据表的数据
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多