Commit 94deeb39 by Gabriel Falcão

verbosity level 2 handling failed scenarios

parent 5a3e7e7e
...@@ -514,6 +514,10 @@ class Scenario(object): ...@@ -514,6 +514,10 @@ class Scenario(object):
def passed(self): def passed(self):
return self.ran and all([step.passed for step in self.steps]) return self.ran and all([step.passed for step in self.steps])
@property
def failed(self):
return any([step.failed for step in self.steps])
def run(self, ignore_case): def run(self, ignore_case):
"""Runs a scenario, running each of its steps. Also call """Runs a scenario, running each of its steps. Also call
before_each and after_each callbacks for steps and scenario""" before_each and after_each callbacks for steps and scenario"""
......
...@@ -893,8 +893,8 @@ def test_output_snippets_with_normalized_unicode_names(): ...@@ -893,8 +893,8 @@ def test_output_snippets_with_normalized_unicode_names():
) )
@with_setup(prepare_stdout) @with_setup(prepare_stdout)
def test_output_level_2(): def test_output_level_2_success():
'Output with verbosity 2 must show only the scenario names, followed by "... OK" or "... FAIL" or "... ERROR"' 'Output with verbosity 2 must show only the scenario names, followed by "... OK" in case of success'
runner = Runner(join(abspath(dirname(__file__)), 'output_features', 'many_successful_scenarios'), verbosity=2) runner = Runner(join(abspath(dirname(__file__)), 'output_features', 'many_successful_scenarios'), verbosity=2)
runner.run() runner.run()
...@@ -907,3 +907,30 @@ def test_output_level_2(): ...@@ -907,3 +907,30 @@ def test_output_level_2():
"2 scenarios (2 passed)\n" "2 scenarios (2 passed)\n"
"2 steps (2 passed)\n" "2 steps (2 passed)\n"
) )
@with_setup(prepare_stdout)
def test_output_level_2_fail():
'Output with verbosity 2 must show only the scenario names, followed by "... FAILED" in case of fail'
runner = Runner(feature_name('failed_table'), verbosity=2)
runner.run()
assert_stdout_lines_with_traceback(
"See it fail ... FAILED\n"
"\n"
"Traceback (most recent call last):\n"
' File "%(lettuce_core_file)s", line %(call_line)d, in __call__\n'
" ret = self.function(self.step, *args, **kw)\n"
' File "%(step_file)s", line 25, in tof\n'
" assert False\n"
"AssertionError\n"
"\n"
"1 feature (0 passed)\n"
"1 scenario (0 passed)\n"
"5 steps (1 failed, 2 skipped, 1 undefined, 1 passed)\n" % {
'lettuce_core_file': lettuce_path('core.py'),
'step_file': abspath(lettuce_path('..', 'tests', 'functional', 'output_features', 'failed_table', 'failed_table_steps.py')),
'call_line':call_line,
}
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment