我应该把 Behave 的实现代码放在哪里,这样它就不会通过 Behave 的测试?此外,我是否需要导入任何内容或放入任何代码,以便我编写的代码链接到功能文件。
这是我的功能文件的摘录\steps\main.feature
...
Feature: Main program
Program allows users to create create and view development logs
Scenario: User requests development logs for a particular user
Given user has requested development logs for a given user
Then the development logs for that user will show
以下是实施建议(来自运行行为):
@given(u'user has requested development logs for a given user')
def step_impl(context):
raise NotImplementedError(u'STEP: Given user has requested development logs for a given user')
@then(u'the development logs for that user will show')
def step_impl(context):
raise NotImplementedError(u'STEP: Then the development logs for that user will show')
我意识到这确实是基本信息,但文档中没有任何内容涵盖这一点,尽管谷歌上有很多教程,但没有一个涵盖这一点。我认为这太基本了。