def test_output_with_success_colorful_many_features():
"Testing the colorful output of many successful features"
runner = Runner(join(abspath(dirname(__file__)), 'output_features', 'many_successful_features'), verbosity=4)
runner.run()
assert_stdout_lines(
"\n"
"\033[1;37mFeature: First feature, of many \033[1;30m# tests/functional/output_features/many_successful_features/one.feature:1\033[0m\n"
"\033[1;37m In order to make lettuce more robust \033[1;30m# tests/functional/output_features/many_successful_features/one.feature:2\033[0m\n"
"\033[1;37m As a programmer \033[1;30m# tests/functional/output_features/many_successful_features/one.feature:3\033[0m\n"
"\033[1;37m I want to test its output on many features \033[1;30m# tests/functional/output_features/many_successful_features/one.feature:4\033[0m\n"
"\n"
"\033[1;37m Scenario: Do nothing \033[1;30m# tests/functional/output_features/many_successful_features/one.feature:6\033[0m\n"
"\033[1;30m Given I do nothing \033[1;30m# tests/functional/output_features/many_successful_features/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_features/dumb_steps.py:6\033[0m\n"
"\033[1;30m Then I see that the test passes \033[1;30m# tests/functional/output_features/many_successful_features/dumb_steps.py:8\033[0m\n"
"\033[A\033[1;32m Then I see that the test passes \033[1;30m# tests/functional/output_features/many_successful_features/dumb_steps.py:8\033[0m\n"
"\n"
"\033[1;37mFeature: Second feature, of many \033[1;30m# tests/functional/output_features/many_successful_features/two.feature:1\033[0m\n"
"\033[1;37m I just want to see it green :) \033[1;30m# tests/functional/output_features/many_successful_features/two.feature:2\033[0m\n"
"\n"
"\033[1;37m Scenario: Do nothing \033[1;30m# tests/functional/output_features/many_successful_features/two.feature:4\033[0m\n"
"\033[1;30m Given I do nothing \033[1;30m# tests/functional/output_features/many_successful_features/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_features/dumb_steps.py:6\033[0m\n"
"\033[1;30m Then I see that the test passes \033[1;30m# tests/functional/output_features/many_successful_features/dumb_steps.py:8\033[0m\n"
"\033[A\033[1;32m Then I see that the test passes \033[1;30m# tests/functional/output_features/many_successful_features/dumb_steps.py:8\033[0m\n"
"\n"
"\033[1;37m2 features (\033[1;32m2 passed\033[1;37m)\033[0m\n" \
"\033[1;37m2 scenarios (\033[1;32m2 passed\033[1;37m)\033[0m\n" \
"\033[1;37m4 steps (\033[1;32m4 passed\033[1;37m)\033[0m\n"
)
def test_output_snippets_with_groups_within_redundant_quotes():
"Testing that the proposed snippet is clever enough to avoid duplicating the same snippet"
runner = Runner(feature_name('redundant-steps-quotes'), verbosity=3)
runner.run()
assert_stdout_lines(
u'\n'
u'Feature: avoid duplicating same snippet # tests/functional/output_features/redundant-steps-quotes/redundant-steps-quotes.feature:1\n'
u'\n'
u' Scenario: Propose matched groups # tests/functional/output_features/redundant-steps-quotes/redundant-steps-quotes.feature:2\n'
u' Given I have "stuff here" and "more @#$%ˆ& bizar sutff h3r3" # tests/functional/output_features/redundant-steps-quotes/redundant-steps-quotes.feature:3 (undefined)\n'
u' Given I have "blablabla" and "12345" # tests/functional/output_features/redundant-steps-quotes/redundant-steps-quotes.feature:4 (undefined)\n'
u'\n'
u'1 feature (0 passed)\n'
u'1 scenario (0 passed)\n'
u'2 steps (2 undefined, 0 passed)\n'
u'\n'
u'You can implement step definitions for undefined steps with these snippets:\n'
u'\n'
u'from lettuce import step\n'
u'\n'
u'@step(r\'Given I have "(.*)" and "(.*)"\')\n'
u'def given_i_have_group1_and_group2(step, group1, group2):\n'
u' pass\n'
)
def test_output_outlines_success_colorless():
"Language: fr -> sucess outlines colorless"
runner = Runner(join_path('fr', 'success', 'outlines.feature'), verbosity=3)
runner.run()
assert_stdout_lines(
'\n'
'Fonctionnalité: Plan de scénario en français # tests/functional/language_specific_features/fr/success/outlines.feature:4\n'
' En tant que programmeur # tests/functional/language_specific_features/fr/success/outlines.feature:5\n'
' Je veux tester les plans de scénario # tests/functional/language_specific_features/fr/success/outlines.feature:6\n'
' Et surtout les sorties # tests/functional/language_specific_features/fr/success/outlines.feature:7\n'
'\n'
' Plan de Scénario: Faire la sieste # tests/functional/language_specific_features/fr/success/outlines.feature:9\n'
' Soit un après midi de <mois> # tests/functional/language_specific_features/fr/success/outlines_steps.py:13\n'
' Quand je veux faire la sieste # tests/functional/language_specific_features/fr/success/outlines_steps.py:22\n'
' Je peux aller <lieux> # tests/functional/language_specific_features/fr/success/outlines_steps.py:26\n'
'\n'
' Exemples:\n'
' | mois | lieux |\n'
' | janvier | près de la cheminé |\n'
' | aôut | dans le transat |\n'
' | octobre | dans le canapé |\n'
'\n'
'1 feature (1 passed)\n'
'3 scenarios (3 passed)\n'
'9 steps (9 passed)\n'
)
def test_output_with_successful_outline_colorful():
"Testing the colorful output of a scenario outline"
runner = Runner(feature_name('success_outline'), verbosity=4)
runner.run()
assert_stdout_lines(
'\n'
'\033[1;37mFeature: Successful Scenario Outline \033[1;30m# tests/functional/output_features/success_outline/success_outline.feature:1\033[0m\n'
'\033[1;37m As lettuce author \033[1;30m# tests/functional/output_features/success_outline/success_outline.feature:2\033[0m\n'
'\033[1;37m In order to finish the first release \033[1;30m# tests/functional/output_features/success_outline/success_outline.feature:3\033[0m\n'
'\033[1;37m I want to make scenario outlines work :) \033[1;30m# tests/functional/output_features/success_outline/success_outline.feature:4\033[0m\n'
'\n'
'\033[1;37m Scenario Outline: fill a web form \033[1;30m# tests/functional/output_features/success_outline/success_outline.feature:6\033[0m\n'
'\033[0;36m Given I open browser at "http://www.my-website.com/" \033[1;30m# tests/functional/output_features/success_outline/success_outline_steps.py:21\033[0m\n'
'\033[0;36m And click on "sign-up" \033[1;30m# tests/functional/output_features/success_outline/success_outline_steps.py:25\033[0m\n'
'\033[0;36m When I fill the field "username" with "<username>" \033[1;30m# tests/functional/output_features/success_outline/success_outline_steps.py:29\033[0m\n'
'\033[0;36m And I fill the field "password" with "<password>" \033[1;30m# tests/functional/output_features/success_outline/success_outline_steps.py:29\033[0m\n'
'\033[0;36m And I fill the field "password-confirm" with "<password>" \033[1;30m# tests/functional/output_features/success_outline/success_outline_steps.py:29\033[0m\n'
'\033[0;36m And I fill the field "email" with "<email>" \033[1;30m# tests/functional/output_features/success_outline/success_outline_steps.py:29\033[0m\n'
'\033[0;36m And I click "done" \033[1;30m# tests/functional/output_features/success_outline/success_outline_steps.py:33\033[0m\n'
'\033[0;36m Then I see the message "<message>" \033[1;30m# tests/functional/output_features/success_outline/success_outline_steps.py:37\033[0m\n'
'\n'
'\033[1;37m Examples:\033[0m\n'
'\033[0;36m \033[1;37m |\033[0;36m username\033[1;37m |\033[0;36m password\033[1;37m |\033[0;36m email \033[1;37m |\033[0;36m message \033[1;37m |\033[0;36m\033[0m\n'
'\033[1;32m \033[1;37m |\033[1;32m john \033[1;37m |\033[1;32m doe-1234\033[1;37m |\033[1;32m [email protected]\033[1;37m |\033[1;32m Welcome, John\033[1;37m |\033[1;32m\033[0m\n'
'\033[1;32m \033[1;37m |\033[1;32m mary \033[1;37m |\033[1;32m wee-9876\033[1;37m |\033[1;32m [email protected]\033[1;37m |\033[1;32m Welcome, Mary\033[1;37m |\033[1;32m\033[0m\n'
'\033[1;32m \033[1;37m |\033[1;32m foo \033[1;37m |\033[1;32m foo-bar \033[1;37m |\033[1;32m [email protected] \033[1;37m |\033[1;32m Welcome, Foo \033[1;37m |\033[1;32m\033[0m\n'
'\n'
"\033[1;37m1 feature (\033[1;32m1 passed\033[1;37m)\033[0m\n" \
"\033[1;37m3 scenarios (\033[1;32m3 passed\033[1;37m)\033[0m\n" \
"\033[1;37m24 steps (\033[1;32m24 passed\033[1;37m)\033[0m\n"
)
def test_output_with_successful_outline_colorless():
"Testing the colorless output of a scenario outline"
runner = Runner(feature_name('success_outline'), verbosity=3)
runner.run()
assert_stdout_lines(
'\n'
'Feature: Successful Scenario Outline # tests/functional/output_features/success_outline/success_outline.feature:1\n'
' As lettuce author # tests/functional/output_features/success_outline/success_outline.feature:2\n'
' In order to finish the first release # tests/functional/output_features/success_outline/success_outline.feature:3\n'
' I want to make scenario outlines work :) # tests/functional/output_features/success_outline/success_outline.feature:4\n'
'\n'
' Scenario Outline: fill a web form # tests/functional/output_features/success_outline/success_outline.feature:6\n'
' Given I open browser at "http://www.my-website.com/" # tests/functional/output_features/success_outline/success_outline_steps.py:21\n'
' And click on "sign-up" # tests/functional/output_features/success_outline/success_outline_steps.py:25\n'
' When I fill the field "username" with "<username>" # tests/functional/output_features/success_outline/success_outline_steps.py:29\n'
' And I fill the field "password" with "<password>" # tests/functional/output_features/success_outline/success_outline_steps.py:29\n'
' And I fill the field "password-confirm" with "<password>" # tests/functional/output_features/success_outline/success_outline_steps.py:29\n'
' And I fill the field "email" with "<email>" # tests/functional/output_features/success_outline/success_outline_steps.py:29\n'
' And I click "done" # tests/functional/output_features/success_outline/success_outline_steps.py:33\n'
' Then I see the message "<message>" # tests/functional/output_features/success_outline/success_outline_steps.py:37\n'
'\n'
' Examples:\n'
' | username | password | email | message |\n'
' | john | doe-1234 | [email protected] | Welcome, John |\n'
' | mary | wee-9876 | [email protected] | Welcome, Mary |\n'
' | foo | foo-bar | [email protected] | Welcome, Foo |\n'
'\n'
'1 feature (1 passed)\n'
'3 scenarios (3 passed)\n'
'24 steps (24 passed)\n'
)
def test_output_outlines_success_colorless():
"Language: ru -> sucess outlines colorless"
runner = Runner(join_path("ru", "success", "outlines.feature"), verbosity=3)
runner.run()
assert_stdout_lines(
"\n"
"Функционал: Проверить вывод структурного сценария # tests/functional/language_specific_features/ru/success/outlines.feature:3\n"
" Как программист # tests/functional/language_specific_features/ru/success/outlines.feature:4\n"
" Для того чобы lettuce был надежным # tests/functional/language_specific_features/ru/success/outlines.feature:5\n"
" Я хочу, что бы сценарии со структурой работали на русском # tests/functional/language_specific_features/ru/success/outlines.feature:6\n"
"\n"
" Структура сценария: Заполнить форму # tests/functional/language_specific_features/ru/success/outlines.feature:8\n"
' Пускай я открываю в браузере "http://sona-studio.com/contacts/" # tests/functional/language_specific_features/ru/success/outlines_steps.py:12\n'
' Когда я заполняю в поле "Имя" "<имя>" # tests/functional/language_specific_features/ru/success/outlines_steps.py:16\n'
' И я заполняю в поле "Email" "<email>" # tests/functional/language_specific_features/ru/success/outlines_steps.py:24\n'
' И я заполняю в поле "Сообщение" "<сообщение>" # tests/functional/language_specific_features/ru/success/outlines_steps.py:32\n'
' И я нажимаю "Отправить" # tests/functional/language_specific_features/ru/success/outlines_steps.py:40\n'
' Тогда я получаю сообщение "Спасибо за ваше сообщение" # tests/functional/language_specific_features/ru/success/outlines_steps.py:43\n'
"\n"
" Примеры:\n"
" | имя | email | сообщение |\n"
" | Виталий Игоревич | [email protected] | Есть интересный проект, нужно обсудить |\n"
" | Марина Банраул | [email protected] | Мне нравятся ваши дизайны, хочу сайт |\n"
"\n"
"1 feature (1 passed)\n"
"2 scenarios (2 passed)\n"
"12 steps (12 passed)\n"
)
def test_output_outlines2_success_colorful():
"Language: fr -> sucess outlines colorful, alternate name"
runner = Runner(join_path('fr', 'success', 'outlines2.feature'), verbosity=4)
runner.run()
assert_stdout_lines(
'\n'
'\033[1;37mFonctionnalité: Plan de scénario en français \033[1;30m# tests/functional/language_specific_features/fr/success/outlines2.feature:4\033[0m\n'
'\033[1;37m En tant que programmeur \033[1;30m# tests/functional/language_specific_features/fr/success/outlines2.feature:5\033[0m\n'
'\033[1;37m Je veux tester les plans de scénario \033[1;30m# tests/functional/language_specific_features/fr/success/outlines2.feature:6\033[0m\n'
'\033[1;37m Et surtout les sorties \033[1;30m# tests/functional/language_specific_features/fr/success/outlines2.feature:7\033[0m\n'
'\n'
'\033[1;37m Plan de Scénario: Faire la sieste \033[1;30m# tests/functional/language_specific_features/fr/success/outlines2.feature:9\033[0m\n'
'\033[0;36m Soit un après midi de <mois> \033[1;30m# tests/functional/language_specific_features/fr/success/outlines_steps.py:13\033[0m\n'
'\033[0;36m Quand je veux faire la sieste \033[1;30m# tests/functional/language_specific_features/fr/success/outlines_steps.py:22\033[0m\n'
'\033[0;36m Je peux aller <lieux> \033[1;30m# tests/functional/language_specific_features/fr/success/outlines_steps.py:26\033[0m\n'
'\n'
'\033[1;37m Exemples:\033[0m\n'
'\033[0;36m \033[1;37m |\033[0;36m mois \033[1;37m |\033[0;36m lieux \033[1;37m |\033[0;36m\033[0m\n'
'\033[1;32m \033[1;37m |\033[1;32m janvier\033[1;37m |\033[1;32m près de la cheminé\033[1;37m |\033[1;32m\033[0m\n'
'\033[1;32m \033[1;37m |\033[1;32m aôut \033[1;37m |\033[1;32m dans le transat \033[1;37m |\033[1;32m\033[0m\n'
'\033[1;32m \033[1;37m |\033[1;32m octobre\033[1;37m |\033[1;32m dans le canapé \033[1;37m |\033[1;32m\033[0m\n'
'\n'
'\033[1;37m1 feature (\033[1;32m1 passed\033[1;37m)\033[0m\n'
'\033[1;37m3 scenarios (\033[1;32m3 passed\033[1;37m)\033[0m\n'
'\033[1;37m9 steps (\033[1;32m9 passed\033[1;37m)\033[0m\n'
)
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)
runner.run()
assert_stdout_lines(
"\n"
"Feature: First feature, of many # tests/functional/output_features/many_successful_features/one.feature:1\n"
" In order to make lettuce more robust # tests/functional/output_features/many_successful_features/one.feature:2\n"
" As a programmer # tests/functional/output_features/many_successful_features/one.feature:3\n"
" I want to test its output on many features # tests/functional/output_features/many_successful_features/one.feature:4\n"
"\n"
" Scenario: Do nothing # tests/functional/output_features/many_successful_features/one.feature:6\n"
" Given I do nothing # tests/functional/output_features/many_successful_features/dumb_steps.py:6\n"
"\033[A Given I do nothing # tests/functional/output_features/many_successful_features/dumb_steps.py:6\n"
" Then I see that the test passes # tests/functional/output_features/many_successful_features/dumb_steps.py:8\n"
"\033[A Then I see that the test passes # tests/functional/output_features/many_successful_features/dumb_steps.py:8\n"
"\n"
"Feature: Second feature, of many # tests/functional/output_features/many_successful_features/two.feature:1\n"
" I just want to see it green :) # tests/functional/output_features/many_successful_features/two.feature:2\n"
"\n"
" Scenario: Do nothing # tests/functional/output_features/many_successful_features/two.feature:4\n"
" Given I do nothing # tests/functional/output_features/many_successful_features/dumb_steps.py:6\n"
"\033[A Given I do nothing # tests/functional/output_features/many_successful_features/dumb_steps.py:6\n"
" Then I see that the test passes # tests/functional/output_features/many_successful_features/dumb_steps.py:8\n"
"\033[A Then I see that the test passes # tests/functional/output_features/many_successful_features/dumb_steps.py:8\n"
"\n"
"2 features (2 passed)\n"
"2 scenarios (2 passed)\n"
"4 steps (4 passed)\n"
)
请发表评论