I am working on a REST-API that validates data (system to system communication). This data is described in XML. The content of the XML is validated using business rules which are implemented in the system. I would like to define scenario's with the client (the three amigos) that test the validation of example XML data-files. How would I go about this?
In my view, I have two options: 1) describe the XML-data as input 2) reference to an existing document.
Scenario Outline: Add valid document Given I have the following XML """ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <element> ..... </element> """ When I POST this XML Then results should not contain value `<code>` at path `<xpath>` Examples: | xpath | code | | /xpath/expression | ERROR_CODE |
Given I have XML with id 1 When I post this XML Then results should not contain value `<code>` at path `<xpath>` Examples: | xpath | code | | /xpath/expression | ERROR_CODE |
Option 1 might be a bit too technical, but to be noted here is that the business knows about validating data, what fields are validated and the expected validation errors. The benefit to this approach is that the test-data is separately defined from the system and is combined with the test-case
Option 2 is better to understand but you are bound to the data which is already in the system.
Do you have any opinions about this?