def test_failing_tables_behave_as_feature():
    "Basic step.behave_as behaviour is working"
    Runner(path_to_feature('3rd_failing_steps'), verbosity=3,
           no_color=True).run()
    assert_stdout_lines_with_traceback(
        '\n'
        'Feature: Multiplication                            # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:2\n'
        '  In order to avoid silly mistakes                 # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:3\n'
        '  Cashiers must be able to multiplicate numbers :) # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:4\n'
        '\n'
        '  Scenario: Regular numbers                        # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:6\n'
        '    Given I have entered 10 into the calculator    # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:11\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 13, in i_have_entered_NUM_into_the_calculator\n'
        '        assert False, \'Die, die, die my darling!\'\n'
        '    AssertionError: Die, die, die my darling!\n'
        '    And I have entered 4 into the calculator       # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:11\n'
        '    When I press multiply                          # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:16\n'
        '    Then the result should be 40 on the screen     # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:20\n'
        '\n'
        '  Scenario: Shorter version of the scenario above  # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:12\n'
        '    Given I multiply 10 and 4 into the calculator  # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:24\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 29, in multiply_X_and_Y_into_the_calculator\n'
        '        \'\'\'.format(x, y))\n'
        '      File "%(lettuce_core_file)s", line %(call_line)d, in __call__\n'
        '        assert not steps_failed, steps_failed[0].why.exception\n'
        '    AssertionError: Die, die, die my darling!\n'
        '    Then the result should be 40 on the screen     # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:20\n'
        '\n'
        '1 feature (0 passed)\n'
        '2 scenarios (0 passed)\n'
        '6 steps (2 failed, 4 skipped, 0 passed)\n'
        '\n'
        'List of failed scenarios:\n'
        '  Scenario: Regular numbers                        # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:6\n'
        '  Scenario: Shorter version of the scenario above  # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:12\n'
        '\n' % {
            'lettuce_core_file':
            lettuce_path('core.py'),
            'step_file':
            abspath(
                lettuce_path('..', 'tests', 'functional', 'behave_as_features',
                             '3rd_failing_steps',
                             'failing_step_definitions.py')),
            'call_line':
            call_line,
        })
Exemplo n.º 2
0
def test_failing_tables_behave_as_feature():
    "Basic step.behave_as behaviour is working"
    Runner(path_to_feature('3rd_failing_steps'), verbosity=3).run()
    assert_stdout_lines_with_traceback(
    '\n'
    'Feature: Multiplication                            # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:2\n'
    '  In order to avoid silly mistakes                 # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:3\n'
    '  Cashiers must be able to multiplicate numbers :) # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:4\n'
    '\n'
    '  Scenario: Regular numbers                        # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:6\n'
    '    Given I have entered 10 into the calculator    # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:11\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 13, in i_have_entered_NUM_into_the_calculator\n'
    '        assert False, \'Die, die, die my darling!\'\n'
    '    AssertionError: Die, die, die my darling!\n'
    '    And I have entered 4 into the calculator       # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:11\n'
    '    When I press multiply                          # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:16\n'
    '    Then the result should be 40 on the screen     # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:20\n'
    '\n'
    '  Scenario: Shorter version of the scenario above  # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:12\n'
    '    Given I multiply 10 and 4 into the calculator  # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:24\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 29, in multiply_X_and_Y_into_the_calculator\n'
    '        \'\'\'.format(x, y))\n'
    '      File "%(lettuce_core_file)s", line %(call_line)d, in __call__\n'
    '        assert not steps_failed, steps_failed[0].why.exception\n'
    '    AssertionError: Die, die, die my darling!\n'
    '    Then the result should be 40 on the screen     # tests/functional/behave_as_features/3rd_failing_steps/failing_step_definitions.py:20\n'
    '\n'
    '1 feature (0 passed)\n'
    '2 scenarios (0 passed)\n'
    '6 steps (2 failed, 4 skipped, 0 passed)\n'
    '\n'
    'List of failed scenarios:\n'
    '  Scenario: Regular numbers                        # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:6\n'
    '  Scenario: Shorter version of the scenario above  # tests/functional/behave_as_features/3rd_failing_steps/3rd_failing_steps.feature:12\n'
    '\n' % {
            'lettuce_core_file': lettuce_path('core.py'),
            'step_file': abspath(lettuce_path('..', 'tests', 'functional', 'behave_as_features', '3rd_failing_steps', 'failing_step_definitions.py')),
            'call_line':call_line,
        }
)
Exemplo n.º 3
0
def test_flaky():
    """Test basic flaky functionality"""

    runner = Runner(join(abspath(dirname(__file__)), 'flaky_features', 'flaky_test'), verbosity=3)
    runner.run()

    assert_stdout_lines_with_traceback(
        ("\n"
        "Feature: Test a feature with non-parametrized flaky tag # tests/functional/flaky_features/flaky_test/flaky.feature:2\n"
        "\n"
        "  @flaky\n"
        "  Scenario: This scenario always Fail          # tests/functional/flaky_features/flaky_test/flaky.feature:4\n"
        "    Given this test step fail                           # tests/functional/flaky_features/flaky_test/flaky.py:14\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 15, in this_step\n'
        "        assert step_actions[action]\n"
        "    AssertionError\n"
        "    Given this test step fail                           # tests/functional/flaky_features/flaky_test/flaky.py:14\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 15, in this_step\n'
        "        assert step_actions[action]\n"
        "    AssertionError\n"
        "\n"
        "  @flaky(3,2) @flaky\n"
        "  Scenario: This scenario always Pass# tests/functional/flaky_features/flaky_test/flaky.feature:8\n"
        "    Given this test step pass                           # tests/functional/flaky_features/flaky_test/flaky.py:14\n"
        "    Given this test step pass                           # tests/functional/flaky_features/flaky_test/flaky.py:14\n"
        "\n"
        "  @flaky\n"
        "  Scenario: This scenario Passes on second run # tests/functional/flaky_features/flaky_test/flaky.feature:11\n"
        "    Given execute the steps                             # tests/functional/flaky_features/flaky_test/flaky.py:19\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 conditional_step\n'
        "        assert False\n"
        "    AssertionError\n"
        "    Given execute the steps                             # tests/functional/flaky_features/flaky_test/flaky.py:19\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 conditional_step\n'
        "        assert False\n"
        "    AssertionError\n"
        "\n"
        "  @flaky(3,2) @flaky\n"
        "  Scenario Outline: Factorials [0-4]# tests/functional/flaky_features/flaky_test/flaky.feature:15\n"
        "    Given I have the number <number>                    # tests/functional/flaky_features/flaky_test/flaky.py:29\n"
        "    When I compute its factorial                        # tests/functional/flaky_features/flaky_test/flaky.py:34\n"
        "    Then I see the number <result>                      # tests/functional/flaky_features/flaky_test/flaky.py:39\n"
        "\n"
        "  Examples:\n"
        "    | number | result |\n"
        "    | 0      | 1      |\n"
        "    Given I have the number <number>                    # tests/functional/flaky_features/flaky_test/flaky.py:29\n"
        "    When I compute its factorial                        # tests/functional/flaky_features/flaky_test/flaky.py:34\n"
        "    Then I see the number <result>                      # tests/functional/flaky_features/flaky_test/flaky.py:39\n"
        "\n"
        "  Examples:\n"
        "    | number | result |\n"
        "    | 0      | 1      |\n"
        "    | 1      | 1      |\n"
        "    | 1      | 1      |\n"
        "    | 2      | 2      |\n"
        "    | 2      | 2      |\n"
        "    | 3      | 6      |\n"
        "    | 3      | 6      |\n"
        "    | 4      | 24     |\n"
        "    | 4      | 24     |\n"
        "\n"
        "1 feature (0 passed)\n"
        "8 scenarios (7 passed)\n"
        "18 steps (1 failed, 17 passed)\n"
        "\n"
        "List of failed scenarios:\n"
        "  @flaky\n"
        "  Scenario: This scenario always Fail          # tests/functional/flaky_features/flaky_test/flaky.feature:4\n"
        "\n") % {
            'lettuce_core_file': lettuce_path('core.py'),
            'step_file': abspath(lettuce_path('..', 'tests', 'functional', 'flaky_features', 'flaky_test')),
            'call_line': call_line,
        }
    )