本文整理汇总了Python中behave.runner.Runner.test_case方法的典型用法代码示例。如果您正苦于以下问题:Python Runner.test_case方法的具体用法?Python Runner.test_case怎么用?Python Runner.test_case使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类behave.runner.Runner
的用法示例。
在下文中一共展示了Runner.test_case方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runTest
# 需要导入模块: from behave.runner import Runner [as 别名]
# 或者: from behave.runner.Runner import test_case [as 别名]
def runTest(self, result=None):
# run behave on a single directory
# from behave/__main__.py
#stream = self.behave_config.output
runner = BehaveRunner(self.behave_config)
runner.test_case = self
failed = runner.run()
try:
undefined_steps = runner.undefined_steps
except AttributeError:
undefined_steps = runner.undefined
if self.behave_config.show_snippets and undefined_steps:
msg = u"\nYou can implement step definitions for undefined steps with "
msg += u"these snippets:\n\n"
printed = set()
if sys.version_info[0] == 3:
string_prefix = "('"
else:
string_prefix = u"(u'"
for step in set(undefined_steps):
if step in printed:
continue
printed.add(step)
msg += u"@" + step.step_type + string_prefix + step.name + u"')\n"
msg += u"def impl(context):\n"
msg += u" assert False\n\n"
sys.stderr.write(escapes['undefined'] + msg + escapes['reset'])
sys.stderr.flush()
if failed:
raise AssertionError('There were behave failures, see output above')