跨测试套件(BDD)的Squish共享步骤定义

时间:2018-08-24 10:17:45

标签: python bdd squish

https://kb.froglogic.com/display/KB/Sharing+step+definitions+across+test+suites+%28BDD%29上,介绍了如何在测试服之间共享步骤定义,但不适用于我。

我的案子:

source(findFile('scripts', 'python/bdd.py'))
setupHooks('../shared/scripts/bdd_hooks.py')

# Collect my custom step definitions:
collectStepDefinitions('/home/myuser/squish/pagesteps/steps')

def main():
    testSettings.throwOnFailure = True
    runFeatureFile('test.feature')

如果我在test.py中进行了设置,则会收到错误消息“未定义给定” 我已实现的步骤未映射(我从“共享/脚本/步骤”路径中清空了步骤文件夹,当您选择“实施缺少的步骤”时会创建步骤)

有人知道如何在文件夹pagesteps中实现所有步骤吗?并与步骤套件无关?

1 个答案:

答案 0 :(得分:-1)

为了在测试套件中共享步骤,并且要更改步骤的默认位置,并将步骤文件夹放置在全局脚本中,必须将collectStepDefinitions()传递到步骤位置控制器的整个路径中

例如:如果您的步骤位于('E:/ myproject / squish / lib / panels / steps'),则将collectStepDefinitions()像这样实现collectStepDefinitions('/ myproject / squish / lib / panels / steps')不是collectStepDefinitions('../ lib / panels / steps')