【发布时间】:2018-11-14 20:18:48
【问题描述】:
我目前正在将机器人框架用于具有 Gherkin 语言策略(Given When Then)的项目。
我的功能文件如下:
*** Settings ***
Documentation
... In Order to eat a dessert safely,
... As a king
... I want to not take a lethal dessert
Library eat_or_pass.Eat_or_pass
*** Test cases ***
Lethal Dessert
[Template] The result of ${hungriness} should be ${dessert}
very hungry apple pie
hungry biscuit
not very hungry apple
*** Keywords ***
The result of ${hungriness} should be ${dessert}
Given the king is ${hungriness}
Then the related dessert is ${dessert}
我想将关键字“Given the king is ${hungriness}”链接到包含在 Python 模块 Eat_or_pass.py 中的 Python 定义,目前实现如下:
class Eat_or_pass(object):
def given_the_king_is_hungriness(self):
pass
当我运行机器人框架时,我有这个错误: “致命甜点 | 失败 | 找不到名为“Given the king is ${hungriness}”的关键字。” 而且我不知道如何解决。有人可以帮我解决这个问题吗?
【问题讨论】:
标签: python templates robotframework bdd gherkin