We have an ASP.NET/MVC WebApi project with a large collection of end-to-end tests driven by Specflow. All the requests and responses so far have been JSON, so this has been working perfectly.
Now however we have an endpoint that expects an XML body, which ideally we would have as a literal in the feature file...
Scenario Outline:
Given I am authenticated
When I post the following XML
"""
<xml>
<foo>
<Bar>
</foo>
</xml>
"""
Then something good happens
Examples:
| Bar |
| apples |
| bananas |
The problem is that we make a fair amount of use of Scenario Outline, and the Specflow/Gherkin syntax for injecting scenario example properties looks like XML tags, e.g. <firstName>.
Is there a way to use Specflow/gherkin with XML documents with scenario outlines to, for exmaple, inject Bar with the values in the examples?
<Bar>also seems clumsy (escaping will be a pain...) Is it necessary for the reader to actually see the XML to understand the feature? Otherwise, you might consider making it something likeWhen I call feature X with the frobber set to <Bar>, and leave the actual XML to the step implementation. (Note that you have the full machinery of the language available to capture/reuse/build the request in this case.) - Jeroen Mostert<Bar>is actually replaced withapplesandbananas. This makes it unclear what your actual problem is: do you merely not like that the replace parameters look like tags? Is there a collision between tags and parameter names? - Jeroen Mostert