| 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 |
Scenario: Use failing assertation in a JUnit XML report |
| 28 |
Given a file named "features/fails1.feature" with: |
| 29 |
""" |
| 30 |
Feature: |
| 31 |
Scenario: Alice |
| 32 |
Given a step fails with message: |
| 33 |
''' |
| 34 |
My name is "Alice" |
| 35 |
''' |
| 36 |
""" |
| 37 |
When I run "behave --junit features/fails1.feature" |
| 38 |
Then it should fail with: |
| 39 |
""" |
| 40 |
0 scenarios passed, 1 failed, 0 skipped |
| 41 |
""" |
| 42 |
And the file "reports/TESTS-fails1.xml" should contain: |
| 43 |
""" |
| 44 |
<failure message="FAILED: My name is "Alice"" |
| 45 |
""" |
| 46 |
|
| 47 |
Scenario: Use exception in a JUnit XML report |
| 48 |
Given a file named "features/fails2.feature" with: |
| 49 |
""" |
| 50 |
Feature: |
| 51 |
Scenario: Bob |
| 52 |
Given a step fails with error and message: |
| 53 |
''' |
| 54 |
My name is "Bob" and <here> I am |
| 55 |
''' |
| 56 |
""" |
| 57 |
When I run "behave --junit features/fails2.feature" |
| 58 |
Then it should fail with: |
| 59 |
""" |
| 60 |
0 scenarios passed, 1 failed, 0 skipped |
| 61 |
""" |
| 62 |
And the file "reports/TESTS-fails2.xml" should contain: |
| 63 |
""" |
| 64 |
<error message="My name is "Bob" and <here> I am" |
| 65 |
""" |