本文整理汇总了Python中tests.asserts.assert_stdout_lines函数的典型用法代码示例。如果您正苦于以下问题:Python assert_stdout_lines函数的具体用法?Python assert_stdout_lines怎么用?Python assert_stdout_lines使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_stdout_lines函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_output_outlines_success_colorful
def test_output_outlines_success_colorful():
"Language: ja -> sucess outlines colorful"
runner = Runner(join_path('ja', 'success', 'outlines.feature'), verbosity=4)
runner.run()
assert_stdout_lines(
'\n'
"\033[1;37mフィーチャ: アウトラインを日本語で書く \033[1;30m# tests/functional/language_specific_features/ja/success/outlines.feature:3\033[0m\n"
"\033[1;37m 図表のテストをパスすること \033[1;30m# tests/functional/language_specific_features/ja/success/outlines.feature:4\033[0m\n"
'\n'
"\033[1;37m シナリオアウトライン: 全てのテストで何もしない \033[1;30m# tests/functional/language_specific_features/ja/success/outlines.feature:6\033[0m\n"
"\033[0;36m 前提 入力値を <データ1> とし \033[1;30m# tests/functional/language_specific_features/ja/success/outlines_steps.py:13\033[0m\n"
"\033[0;36m もし 処理 <方法> を使って \033[1;30m# tests/functional/language_specific_features/ja/success/outlines_steps.py:22\033[0m\n"
"\033[0;36m ならば 表示は <結果> である \033[1;30m# tests/functional/language_specific_features/ja/success/outlines_steps.py:31\033[0m\n"
'\n'
"\033[1;37m 例:\033[0m\n"
"\033[0;36m \033[1;37m |\033[0;36m データ1\033[1;37m |\033[0;36m 方法\033[1;37m |\033[0;36m 結果 \033[1;37m |\033[0;36m\033[0m\n"
"\033[1;32m \033[1;37m |\033[1;32m 何か \033[1;37m |\033[1;32m これ\033[1;37m |\033[1;32m 機能 \033[1;37m |\033[1;32m\033[0m\n"
"\033[1;32m \033[1;37m |\033[1;32m その他 \033[1;37m |\033[1;32m ここ\033[1;37m |\033[1;32m 同じ \033[1;37m |\033[1;32m\033[0m\n"
"\033[1;32m \033[1;37m |\033[1;32m データ \033[1;37m |\033[1;32m 動く\033[1;37m |\033[1;32m unicodeで!\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"
)
示例2: test_output_outlines_success_colorful
def test_output_outlines_success_colorful():
"Language: ru -> sucess outlines colorful"
runner = Runner(join_path("ru", "success", "outlines.feature"), verbosity=4)
runner.run()
assert_stdout_lines(
"\n"
"\x1b[1;37m\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b: \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines.feature:3\x1b[0m\n"
"\x1b[1;37m \u041a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines.feature:4\x1b[0m\n"
"\x1b[1;37m \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u043e\u0431\u044b lettuce \u0431\u044b\u043b \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u043c \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines.feature:5\x1b[0m\n"
"\x1b[1;37m \u042f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e \u0431\u044b \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines.feature:6\x1b[0m\n"
"\n"
"\x1b[1;37m \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f: \u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines.feature:8\x1b[0m\n"
'\x1b[0;36m \u041f\u0443\u0441\u043a\u0430\u0439 \u044f \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 "http://sona-studio.com/contacts/" \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines_steps.py:12\x1b[0m\n'
'\x1b[0;36m \u041a\u043e\u0433\u0434\u0430 \u044f \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e \u0432 \u043f\u043e\u043b\u0435 "\u0418\u043c\u044f" "<\u0438\u043c\u044f>" \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines_steps.py:16\x1b[0m\n'
'\x1b[0;36m \u0418 \u044f \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e \u0432 \u043f\u043e\u043b\u0435 "Email" "<email>" \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines_steps.py:24\x1b[0m\n'
'\x1b[0;36m \u0418 \u044f \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e \u0432 \u043f\u043e\u043b\u0435 "\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435" "<\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435>" \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines_steps.py:32\x1b[0m\n'
'\x1b[0;36m \u0418 \u044f \u043d\u0430\u0436\u0438\u043c\u0430\u044e "\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c" \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines_steps.py:40\x1b[0m\n'
'\x1b[0;36m \u0422\u043e\u0433\u0434\u0430 \u044f \u043f\u043e\u043b\u0443\u0447\u0430\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 "\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u0430\u0448\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435" \x1b[1;30m# tests/functional/language_specific_features/ru/success/outlines_steps.py:43\x1b[0m\n'
"\n"
"\x1b[1;37m \u041f\u0440\u0438\u043c\u0435\u0440\u044b:\x1b[0m\n"
"\x1b[0;36m \x1b[1;37m |\x1b[0;36m \u0438\u043c\u044f \x1b[1;37m |\x1b[0;36m email \x1b[1;37m |\x1b[0;36m \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \x1b[1;37m |\x1b[0;36m\x1b[0m\n"
"\x1b[1;32m \x1b[1;37m |\x1b[1;32m \u0412\u0438\u0442\u0430\u043b\u0438\u0439 \u0418\u0433\u043e\u0440\u0435\u0432\u0438\u0447\x1b[1;37m |\x1b[1;32m [email protected]\x1b[1;37m |\x1b[1;32m \u0415\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c\x1b[1;37m |\x1b[1;32m\x1b[0m\n"
"\x1b[1;32m \x1b[1;37m |\x1b[1;32m \u041c\u0430\u0440\u0438\u043d\u0430 \u0411\u0430\u043d\u0440\u0430\u0443\u043b \x1b[1;37m |\x1b[1;32m [email protected]\x1b[1;37m |\x1b[1;32m \u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f \u0432\u0430\u0448\u0438 \u0434\u0438\u0437\u0430\u0439\u043d\u044b, \u0445\u043e\u0447\u0443 \u0441\u0430\u0439\u0442 \x1b[1;37m |\x1b[1;32m\x1b[0m\n"
"\n"
"\x1b[1;37m1 feature (\x1b[1;32m1 passed\x1b[1;37m)\x1b[0m\n"
"\x1b[1;37m2 scenarios (\x1b[1;32m2 passed\x1b[1;37m)\x1b[0m\n"
"\x1b[1;37m12 steps (\x1b[1;32m12 passed\x1b[1;37m)\x1b[0m\n"
)
示例3: test_output_with_success_colorful_many_features
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"
)
示例4: test_output_outlines_success_colorless
def test_output_outlines_success_colorless():
"Language: pt-br -> sucess outlines colorless"
runner = Runner(join_path('pt-br', 'success', 'outlines.feature'), verbosity=3)
runner.run()
assert_stdout_lines(
u'\n'
u'Funcionalidade: outlines em português # tests/functional/language_specific_features/pt-br/success/outlines.feature:3\n'
u' Como um programador # tests/functional/language_specific_features/pt-br/success/outlines.feature:4\n'
u' Eu quero testar cenários esquemáticos # tests/functional/language_specific_features/pt-br/success/outlines.feature:5\n'
u' Para ver o output em pt-br # tests/functional/language_specific_features/pt-br/success/outlines.feature:6\n'
u'\n'
u' Esquema do Cenário: Fazer nada, repetidas vezes, através de esquemas # tests/functional/language_specific_features/pt-br/success/outlines.feature:8\n'
u' Dado que tenho o <dado1> # tests/functional/language_specific_features/pt-br/success/outlines_steps.py:13\n'
u' Quando eu faço algo com <isso> # tests/functional/language_specific_features/pt-br/success/outlines_steps.py:22\n'
u' Então eu fico feliz em ver <aquilo> # tests/functional/language_specific_features/pt-br/success/outlines_steps.py:31\n'
u'\n'
u' Exemplos:\n'
u' | dado1 | isso | aquilo |\n'
u' | algo | assim | funcional |\n'
u' | outro | aqui | também |\n'
u' | dados | funcionarão | com unicode ! |\n'
u'\n'
u'1 feature (1 passed)\n'
u'3 scenarios (3 passed)\n'
u'9 steps (9 passed)\n'
)
示例5: test_output_outlines_success_colorless
def test_output_outlines_success_colorless():
"Language: zh-CN -> sucess outlines colorless"
runner = Runner(join_path('zh-CN', 'success', 'outlines.feature'), verbosity=3)
runner.run()
assert_stdout_lines(
"\n"
"特性: 中文场景模板 # tests/functional/language_specific_features/zh-CN/success/outlines.feature:3\n"
" 中文场景模板图表测试 # tests/functional/language_specific_features/zh-CN/success/outlines.feature:4\n"
"\n"
" 场景模板: 用表格描述场景 # tests/functional/language_specific_features/zh-CN/success/outlines.feature:6\n"
" 如果 输入是<输入> # tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:13\n"
" 当 执行<处理>时 # tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:22\n"
" 那么 得到<结果> # tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:31\n"
"\n"
" 例如:\n"
" | 输入 | 处理 | 结果 |\n"
" | 什么 | 这个 | 功能 |\n"
" | 其他 | 这里 | 一样 |\n"
" | 数据 | 动作 | unicode输出! |\n"
"\n"
"1 feature (1 passed)\n"
"3 scenarios (3 passed)\n"
"9 steps (9 passed)\n"
)
示例6: test_output_outlines_success_colorful
def test_output_outlines_success_colorful():
"Language: pt-br -> sucess outlines colorful"
runner = Runner(join_path('pt-br', 'success', 'outlines.feature'), verbosity=4)
runner.run()
assert_stdout_lines(
u'\n'
u'\033[1;37mFuncionalidade: outlines em português \033[1;30m# tests/functional/language_specific_features/pt-br/success/outlines.feature:3\033[0m\n'
u'\033[1;37m Como um programador \033[1;30m# tests/functional/language_specific_features/pt-br/success/outlines.feature:4\033[0m\n'
u'\033[1;37m Eu quero testar cenários esquemáticos \033[1;30m# tests/functional/language_specific_features/pt-br/success/outlines.feature:5\033[0m\n'
u'\033[1;37m Para ver o output em pt-br \033[1;30m# tests/functional/language_specific_features/pt-br/success/outlines.feature:6\033[0m\n'
u'\n'
u'\033[1;37m Esquema do Cenário: Fazer nada, repetidas vezes, através de esquemas \033[1;30m# tests/functional/language_specific_features/pt-br/success/outlines.feature:8\033[0m\n'
u'\033[0;36m Dado que tenho o <dado1> \033[1;30m# tests/functional/language_specific_features/pt-br/success/outlines_steps.py:13\033[0m\n'
u'\033[0;36m Quando eu faço algo com <isso> \033[1;30m# tests/functional/language_specific_features/pt-br/success/outlines_steps.py:22\033[0m\n'
u'\033[0;36m Então eu fico feliz em ver <aquilo> \033[1;30m# tests/functional/language_specific_features/pt-br/success/outlines_steps.py:31\033[0m\n'
u'\n'
u'\033[1;37m Exemplos:\033[0m\n'
u'\033[0;36m \033[1;37m |\033[0;36m dado1\033[1;37m |\033[0;36m isso \033[1;37m |\033[0;36m aquilo \033[1;37m |\033[0;36m\033[0m\n'
u'\033[1;32m \033[1;37m |\033[1;32m algo \033[1;37m |\033[1;32m assim \033[1;37m |\033[1;32m funcional \033[1;37m |\033[1;32m\033[0m\n'
u'\033[1;32m \033[1;37m |\033[1;32m outro\033[1;37m |\033[1;32m aqui \033[1;37m |\033[1;32m também \033[1;37m |\033[1;32m\033[0m\n'
u'\033[1;32m \033[1;37m |\033[1;32m dados\033[1;37m |\033[1;32m funcionarão\033[1;37m |\033[1;32m com unicode !\033[1;37m |\033[1;32m\033[0m\n'
u'\n'
u"\033[1;37m1 feature (\033[1;32m1 passed\033[1;37m)\033[0m\n" \
u"\033[1;37m3 scenarios (\033[1;32m3 passed\033[1;37m)\033[0m\n" \
u"\033[1;37m9 steps (\033[1;32m9 passed\033[1;37m)\033[0m\n"
)
示例7: test_output_snippets_with_groups_within_single_quotes_colorful
def test_output_snippets_with_groups_within_single_quotes_colorful():
"Testing that the proposed snippet is clever enough to identify groups within single quotes. colorful"
runner = Runner(feature_name('single-quoted-snippet'), verbosity=4)
runner.run()
assert_stdout_lines(
u'\n'
u'\033[1;37mFeature: single-quoted snippet proposal \033[1;30m# tests/functional/output_features/single-quoted-snippet/single-quoted-snippet.feature:1\033[0m\n'
u'\n'
u'\033[1;37m Scenario: Propose matched groups \033[1;30m# tests/functional/output_features/single-quoted-snippet/single-quoted-snippet.feature:2\033[0m\n'
u'\033[0;33m Given I have \'stuff here\' and \'more @#$%ˆ& bizar sutff h3r3\' \033[1;30m# tests/functional/output_features/single-quoted-snippet/single-quoted-snippet.feature:3\033[0m\n'
u'\n'
"\033[1;37m1 feature (\033[0;31m0 passed\033[1;37m)\033[0m\n" \
"\033[1;37m1 scenario (\033[0;31m0 passed\033[1;37m)\033[0m\n" \
"\033[1;37m1 step (\033[0;33m1 undefined\033[1;37m, \033[1;32m0 passed\033[1;37m)\033[0m\n"
u'\n'
u'\033[0;33mYou 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\033[0m\n'
)
示例8: test_output_snippets_with_groups_within_redundant_quotes
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'
)
示例9: test_output_outlines_success_colorless
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'
)
示例10: test_output_snippets_with_groups_within_single_quotes_colorless
def test_output_snippets_with_groups_within_single_quotes_colorless():
"Testing that the proposed snippet is clever enough to identify groups within single quotes. colorless"
runner = Runner(feature_name('single-quoted-snippet'), verbosity=3)
runner.run()
assert_stdout_lines(
u'\n'
u'Feature: single-quoted snippet proposal # tests/functional/output_features/single-quoted-snippet/single-quoted-snippet.feature:1\n'
u'\n'
u' Scenario: Propose matched groups # tests/functional/output_features/single-quoted-snippet/single-quoted-snippet.feature:2\n'
u' Given I have \'stuff here\' and \'more @#$%ˆ& bizar sutff h3r3\' # tests/functional/output_features/single-quoted-snippet/single-quoted-snippet.feature:3 (undefined)\n'
u'\n'
u'1 feature (0 passed)\n'
u'1 scenario (0 passed)\n'
u'1 step (1 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'
)
示例11: test_output_with_successful_outline_colorful
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"
)
示例12: test_output_with_successful_outline_colorless
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'
)
示例13: test_output_outlines_success_colorless
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"
)
示例14: test_output_outlines2_success_colorful
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'
)
示例15: test_output_of_table_with_success_colorless
def test_output_of_table_with_success_colorless():
"Language: pt-br -> sucess table colorless"
runner = Runner(join_path('pt-br', 'success', 'table.feature'), verbosity=3)
runner.run()
assert_stdout_lines(
u"\n"
u"Funcionalidade: feature burra, com tabela # tests/functional/language_specific_features/pt-br/success/table.feature:3\n"
u" Como um programador # tests/functional/language_specific_features/pt-br/success/table.feature:4\n"
u" Eu quero testar steps com tabelas # tests/functional/language_specific_features/pt-br/success/table.feature:5\n"
u" Para ver o output em pt-br # tests/functional/language_specific_features/pt-br/success/table.feature:6\n"
u"\n"
u" Cenário: Fazer nada, com tabelas :) # tests/functional/language_specific_features/pt-br/success/table.feature:8\n"
u" Dado que eu brinco com os seguintes itens: # tests/functional/language_specific_features/pt-br/success/table_steps.py:6\n"
u" | id | description |\n"
u" | 12 | some desc |\n"
u" | 64 | another desc |\n"
u"\033[A\033[A\033[A\033[A Dado que eu brinco com os seguintes itens: # tests/functional/language_specific_features/pt-br/success/table_steps.py:6\n"
u" | id | description |\n"
u" | 12 | some desc |\n"
u" | 64 | another desc |\n"
u"\n"
u"1 feature (1 passed)\n"
u"1 scenario (1 passed)\n"
u"1 step (1 passed)\n"
)