Commit a23cbb33 by Andres Jaan Tack

Added a line break between scenarios, making the output a little nicer to look at.

parent f20baea0
......@@ -114,7 +114,7 @@ def print_step_ran(step):
def print_scenario_running(scenario):
string = scenario.represented()
string = wrap_file_and_line(string, '\033[1;30m', '\033[0m')
write_out("\033[1;37m%s" % string)
write_out("\n\033[1;37m%s" % string)
@after.outline
def print_outline(scenario, order, outline, reasons_to_fail):
......@@ -152,8 +152,6 @@ def print_feature_running(feature):
line = wrap_file_and_line(line, '\033[1;30m', '\033[0m')
write_out("\033[1;37m%s\n" % line)
write_out("\n")
@after.all
def print_end(total):
write_out("\n")
......
......@@ -56,6 +56,7 @@ def print_step_ran(step):
@before.each_scenario
def print_scenario_running(scenario):
wrt('\n')
wrt(scenario.represented())
@after.outline
......@@ -82,7 +83,6 @@ def print_outline(scenario, order, outline, reasons_to_fail):
def print_feature_running(feature):
wrt("\n")
wrt(feature.represented())
wrt("\n")
@after.all
def print_end(total):
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lettuce import step
@step('Given I do nothing')
def do_nothing(step): pass
@step('Then I see that the test passes')
def see_test_passes(step): pass
Feature: Dumb feature
In order to test success
As a programmer
I want to see that the output is green
Scenario: Do nothing
Given I do nothing
Scenario: Do nothing (again)
Given I do nothing (again)
......@@ -159,6 +159,33 @@ def test_output_with_success_colorless():
)
@with_setup(prepare_stdout)
def test_output_with_success_colorless():
"A feature with two scenarios should separate the two scenarios with a new line (in colorless mode)."
runner = Runner(join(abspath(dirname(__file__)), 'output_features', 'many_successful_scenarios'), verbosity=3)
runner.run()
assert_stdout_lines(
"\n"
"Feature: Dumb feature # tests/functional/output_features/many_successful_scenarios/first.feature:1\n"
" In order to test success # tests/functional/output_features/many_successful_scenarios/first.feature:2\n"
" As a programmer # tests/functional/output_features/many_successful_scenarios/first.feature:3\n"
" I want to see that the output is green # tests/functional/output_features/many_successful_scenarios/first.feature:4\n"
"\n"
" Scenario: Do nothing # tests/functional/output_features/many_successful_scenarios/first.feature:6\n"
" Given I do nothing # tests/functional/output_features/many_successful_scenarios/dumb_steps.py:6\n"
"\033[A Given I do nothing # tests/functional/output_features/many_successful_scenarios/dumb_steps.py:6\n"
"\n"
" Scenario: Do nothing (again) # tests/functional/output_features/many_successful_scenarios/first.feature:9\n"
" Given I do nothing (again) # tests/functional/output_features/many_successful_scenarios/dumb_steps.py:6\n"
"\033[A Given I do nothing (again) # tests/functional/output_features/many_successful_scenarios/dumb_steps.py:6\n"
"\n"
"1 feature (1 passed)\n"
"2 scenarios (2 passed)\n"
"2 steps (2 passed)\n"
)
@with_setup(prepare_stdout)
def test_output_with_success_colorful():
"Testing the output of a successful feature"
......@@ -182,6 +209,33 @@ def test_output_with_success_colorful():
)
@with_setup(prepare_stdout)
def test_output_with_success_colorful():
"A feature with two scenarios should separate the two scenarios with a new line (in color mode)."
runner = Runner(join(abspath(dirname(__file__)), 'output_features', 'many_successful_scenarios'), verbosity=4)
runner.run()
assert_stdout_lines(
"\n" \
"\033[1;37mFeature: Dumb feature \033[1;30m# tests/functional/output_features/many_successful_scenarios/first.feature:1\033[0m\n" \
"\033[1;37m In order to test success \033[1;30m# tests/functional/output_features/many_successful_scenarios/first.feature:2\033[0m\n" \
"\033[1;37m As a programmer \033[1;30m# tests/functional/output_features/many_successful_scenarios/first.feature:3\033[0m\n" \
"\033[1;37m I want to see that the output is green \033[1;30m# tests/functional/output_features/many_successful_scenarios/first.feature:4\033[0m\n" \
"\n" \
"\033[1;37m Scenario: Do nothing \033[1;30m# tests/functional/output_features/many_successful_scenarios/first.feature:6\033[0m\n" \
"\033[1;30m Given I do nothing \033[1;30m# tests/functional/output_features/many_successful_scenarios/dumb_steps.py:6\033[0m\n" \
"\033[A\033[1;32m Given I do nothing \033[1;30m# tests/functional/output_features/many_successful_scenarios/dumb_steps.py:6\033[0m\n" \
"\n" \
"\033[1;37m Scenario: Do nothing (again) \033[1;30m# tests/functional/output_features/many_successful_scenarios/first.feature:9\033[0m\n" \
"\033[1;30m Given I do nothing (again) \033[1;30m# tests/functional/output_features/many_successful_scenarios/dumb_steps.py:6\033[0m\n" \
"\033[A\033[1;32m Given I do nothing (again) \033[1;30m# tests/functional/output_features/many_successful_scenarios/dumb_steps.py:6\033[0m\n" \
"\n" \
"\033[1;37m1 feature (\033[1;32m1 passed\033[1;37m)\033[0m\n" \
"\033[1;37m2 scenarios (\033[1;32m2 passed\033[1;37m)\033[0m\n" \
"\033[1;37m2 steps (\033[1;32m2 passed\033[1;37m)\033[0m\n"
)
@with_setup(prepare_stdout)
def test_output_with_success_colorless_many_features():
"Testing the output of many successful features"
runner = Runner(join(abspath(dirname(__file__)), 'output_features', 'many_successful_features'), verbosity=3)
......
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