File: issue0597.feature

package info (click to toggle)
behave 1.2.6-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,160 kB
  • sloc: python: 19,857; makefile: 137; sh: 18
file content (134 lines) | stat: -rw-r--r-- 3,466 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@issue
Feature: Issue #597 -- Steps with accented letters doesn't seem to work


  Background:
    Given a new working directory
    And a file named "features/french.feature" with:
      """
      # language: fr
      Fonctionnalité: Alice

        Scénario: A1
          Soit allé
          Quand comment
          Alors cava
      """
    And a file named "behave.ini" with:
      """
      [behave]
      show_timings = false
      """

  Scenario: Passing w/o Encoding-Hint in Steps File (case: py2, py3)
    Given a file named "features/steps/french_steps.py" with:
      """
      # -*- coding: UTF-8 -*-
      from behave import given, when, then

      @given(u'allé')
      def given_step_alle(ctx):
          pass

      @when(u'comment')
      def when_step_comment(ctx):
          pass

      @then(u'cava')
      def then_step_cava(ctx):
          pass
      """
    When  I run "behave -f plain features/"
    Then it should pass with:
      """
      Fonctionnalité: Alice

        Scénario: A1
          Soit allé ... passed
          Quand comment ... passed
          Alors cava ... passed

      1 feature passed, 0 failed, 0 skipped
      1 scenario passed, 0 failed, 0 skipped
      3 steps passed, 0 failed, 0 skipped, 0 undefined
      """

  @only.with_python2=true
  Scenario: Failing w/o Encoding-Hint in Steps File (case: python2)
    Given a file named "features/steps/french_steps.py" with:
      """
      from behave import given, when, then

      @given(u'allé')
      def given_step_alle(ctx):
          pass

      @when(u'comment')
      def when_step_comment(ctx):
          pass

      @then(u'cava')
      def then_step_cava(ctx):
          pass
      """
    When  I run "behave -f plain features/"
    Then it should fail with:
      """
      0 features passed, 1 failed, 0 skipped
      0 scenarios passed, 1 failed, 0 skipped
      0 steps passed, 0 failed, 2 skipped, 1 undefined
      """
    And the command output should contain:
      """
      Scénario: A1
        Soit allé ... undefined
      """
    And the command output should contain:
      """
      You can implement step definitions for undefined steps with these snippets:

      @given(u'allé')
      def step_impl(context):
          raise NotImplementedError(u'STEP: Given allé')
      """
    But note that "python2 uses encoding=ascii"
    And note that "encoding-hint in steps file solves the problem"


  @not.with_python2=true
  Scenario: Passing w/o Encoding-Hint in Steps File (case: python3)
    Given a file named "features/steps/french_steps.py" with:
      """
      from behave import given, when, then

      @given(u'allé')
      def given_step_alle(ctx):
          pass

      @when(u'comment')
      def when_step_comment(ctx):
          pass

      @then(u'cava')
      def then_step_cava(ctx):
          pass
      """
    When  I run "behave -f plain features/"
    Then it should pass with:
      """
      1 feature passed, 0 failed, 0 skipped
      1 scenario passed, 0 failed, 0 skipped
      3 steps passed, 0 failed, 0 skipped, 0 undefined
      """
    And the command output should contain:
      """
      Scénario: A1
        Soit allé ... passed
      """
    And the command output should not contain:
      """
      @given(u'allé')
      def step_impl(context):
          raise NotImplementedError(u'STEP: Given allé')
      """
    But note that "python3 discovers encoding (or uses encoding=UTF-8)"