| 1 |
@not_reproducible |
| 2 |
@issue |
| 3 |
Feature: Issue #457 -- Double-quotes in error messages of JUnit XML reports |
| 4 |
|
| 5 |
STATUS: Problem is currently not reproducible. |
| 6 |
XML attributes are escaped correctly even when double-quotes are used. |
| 7 |
|
| 8 |
@setup |
| 9 |
Scenario: Feature Setup |
| 10 |
Given a new working directory |
| 11 |
And a file named "features/steps/fail_steps.py" with: |
| 12 |
""" |
| 13 |
from behave import step |
| 14 |
|
| 15 |
@step('{word:w} step fails with message') |
| 16 |
def step_fails(context, word): |
| 17 |
assert context.text |
| 18 |
assert False, "FAILED: "+ context.text |
| 19 |
|
| 20 |
@step('{word:w} step fails with error and message') |
| 21 |
def step_fails2(context, word): |
| 22 |
assert context.text |
| 23 |
raise RuntimeError(context.text) |
| 24 |
""" |
| 25 |
|
| 26 |
|
| •27 |
@not.with_python.version=3.8 |
| 28 |
Scenario: Use failing assertation in a JUnit XML report |
| 29 |
Given a file named "features/fails1.feature" with: |
| 30 |
""" |
| 31 |
Feature: |
| 32 |
Scenario: Alice |
| 33 |
Given a step fails with message: |
| 34 |
''' |
| 35 |
My name is "Alice" |
| 36 |
''' |
| 37 |
""" |
| 38 |
When I run "behave --junit features/fails1.feature" |
| 39 |
Then it should fail with: |
| 40 |
""" |
| 41 |
0 scenarios passed, 1 failed, 0 skipped |
| 42 |
""" |
| 43 |
And the file "reports/TESTS-fails1.xml" should contain: |
| 44 |
""" |
| 45 |
<failure message="FAILED: My name is "Alice"" |
| 46 |
""" |
| 47 |
|
| •48 |
@use.with_python.version=3.8 |
| 49 |
Scenario: Use failing assertation in a JUnit XML report |
| 50 |
Given a file named "features/fails1.feature" with: |
| 51 |
""" |
| 52 |
Feature: |
| 53 |
Scenario: Alice |
| 54 |
Given a step fails with message: |
| 55 |
''' |
| 56 |
My name is "Alice" |
| 57 |
''' |
| 58 |
""" |
| 59 |
When I run "behave --junit features/fails1.feature" |
| 60 |
Then it should fail with: |
| 61 |
""" |
| 62 |
0 scenarios passed, 1 failed, 0 skipped |
| 63 |
""" |
| 64 |
And the file "reports/TESTS-fails1.xml" should contain: |
| 65 |
""" |
| 66 |
<failure type="AssertionError" message="FAILED: My name is "Alice""> |
| 67 |
""" |
| 68 |
# -- HINT FOR: Python < 3.8 |
| 69 |
# <failure message="FAILED: My name is "Alice"" |
| 70 |
|
| 71 |
|
| 72 |
@not.with_python.version=3.8 |
| 73 |
Scenario: Use exception in a JUnit XML report |
| 74 |
Given a file named "features/fails2.feature" with: |
| 75 |
""" |
| 76 |
Feature: |
| 77 |
Scenario: Bob |
| 78 |
Given a step fails with error and message: |
| 79 |
''' |
| 80 |
My name is "Bob" and <here> I am |
| 81 |
''' |
| 82 |
""" |
| 83 |
When I run "behave --junit features/fails2.feature" |
| 84 |
Then it should fail with: |
| 85 |
""" |
| 86 |
0 scenarios passed, 1 failed, 0 skipped |
| 87 |
""" |
| 88 |
And the file "reports/TESTS-fails2.xml" should contain: |
| 89 |
""" |
| 90 |
<error message="My name is "Bob" and <here> I am" |
| 91 |
""" |
| •92 |
|
| 93 |
@use.with_python.version=3.8 |
| 94 |
Scenario: Use exception in a JUnit XML report |
| 95 |
Given a file named "features/fails2.feature" with: |
| 96 |
""" |
| 97 |
Feature: |
| 98 |
Scenario: Bob |
| 99 |
Given a step fails with error and message: |
| 100 |
''' |
| 101 |
My name is "Bob" and <here> I am |
| 102 |
''' |
| 103 |
""" |
| 104 |
When I run "behave --junit features/fails2.feature" |
| 105 |
Then it should fail with: |
| 106 |
""" |
| 107 |
0 scenarios passed, 1 failed, 0 skipped |
| 108 |
""" |
| 109 |
And the file "reports/TESTS-fails2.xml" should contain: |
| 110 |
""" |
| 111 |
<error type="RuntimeError" message="My name is "Bob" and <here> I am"> |
| 112 |
""" |
| 113 |
# -- HINT FOR: Python < 3.8 |
| 114 |
# <error message="My name is "Bob" and <here> I am" |