本文整理匯總了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')