Commit a3a7cb91 by Danielle Madeley

Add a file which includes the steps

This lets us quickly see which step failed, and any steps which are
undefined.
parent d3c5e470
...@@ -93,15 +93,32 @@ def enable(filename=None): ...@@ -93,15 +93,32 @@ def enable(filename=None):
@after.each_step @after.each_step
def after_step(step): def after_step(step):
if not step.passed: if step.passed:
marker = u'✔'
elif not step.defined_at:
marker = u'?'
elif step.failed:
marker = u'❌'
try: try:
streamresult.status(test_id=get_test_id(step.scenario), streamresult.status(test_id=get_test_id(step.scenario),
file_name='traceback', file_name='traceback',
file_bytes=bytes(step.why.traceback), file_bytes=step.why.traceback.encode('utf-8'),
mime_type='text/plain; charset=utf8') mime_type='text/plain; charset=utf8')
except AttributeError: except AttributeError:
pass pass
elif not step.ran:
marker = u' '
else:
raise AssertionError("Internal error")
steps = u'{} {}\n'.format(marker, step.sentence)
streamresult.status(test_id=get_test_id(step.scenario),
file_name='steps',
file_bytes=steps.encode('utf-8'),
mime_type='text/plain; charset=utf8')
@after.all @after.all
def after_all(total): def after_all(total):
......
...@@ -123,7 +123,7 @@ def test_subunit_output_with_no_errors(): ...@@ -123,7 +123,7 @@ def test_subunit_output_with_no_errors():
Includes({ Includes({
'id': 'one commented scenario: Do nothing', 'id': 'one commented scenario: Do nothing',
'status': 'success', 'status': 'success',
'details': Keys('stdout', 'stderr'), 'details': Keys('stdout', 'stderr', 'steps'),
}), }),
] ]
...@@ -140,11 +140,11 @@ def test_subunit_output_with_one_error(): ...@@ -140,11 +140,11 @@ def test_subunit_output_with_one_error():
state.expect = [ state.expect = [
Includes({ Includes({
'status': 'success', 'status': 'success',
'details': Keys('stdout', 'stderr'), 'details': Keys('stdout', 'stderr', 'steps'),
}), }),
Includes({ Includes({
'status': 'fail', 'status': 'fail',
'details': Keys('stdout', 'stderr', 'traceback'), 'details': Keys('stdout', 'stderr', 'traceback', 'steps'),
}), }),
] ]
...@@ -227,6 +227,7 @@ def test_subunit_output_console(): ...@@ -227,6 +227,7 @@ def test_subunit_output_console():
runner = Runner(feature_name('writes_to_console'), enable_subunit=True) runner = Runner(feature_name('writes_to_console'), enable_subunit=True)
runner.run() runner.run()
@with_setup(state.setup, state.teardown) @with_setup(state.setup, state.teardown)
def test_subunit_output_undefined_steps(): def test_subunit_output_undefined_steps():
""" """
...@@ -236,9 +237,15 @@ def test_subunit_output_undefined_steps(): ...@@ -236,9 +237,15 @@ def test_subunit_output_undefined_steps():
state.expect = [ state.expect = [
Includes({ Includes({
'status': 'fail', 'status': 'fail',
'details': Includes({
'steps': ContentContains('? When this test step is undefined\n'),
}),
}), }),
Includes({ Includes({
'status': 'fail', 'status': 'fail',
'details': Includes({
'steps': ContentContains('? When this test step is undefined\n'),
}),
}), }),
] ]
......
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