Individual Node Assertion on Repeating XML nodes where not all data is known

reactancexlreactancexl Posts: 91

I have a scenario where I post data to a rest service and the message has repeatable items, for instance multiple lineitems. On the response I would like do do assertions at the line level where some of the data will come from the Request message and some are unkown but I can verify existence, type, length etc. I can do "non-repeating items by using "writeable DB source" and xpath to the response node but having issues on how to do this on repeating nodes. What is the best way to accomplish this. I know I can use the create/update regression control as the data would be same each time, but will not work on "unknown" values. As stated above some will be avail on request. thx

Comments

  • jakubiakjakubiak Posts: 311 ✭✭✭

    Create/update regression control could work, if you add ignored XPaths for the "unknown values". You can easily do that by running the regression control after it has been created, and then right-clicking on an error reported and choosing "Ignore XPath".

  • reactancexlreactancexl Posts: 91

    Yes, that does work however I do not want to ignore those values. I want to get some of the values on the request and on the others I would like to verify length, exists etc of return value and not necessarily the "Actual" value. Hope this helps explain. thx

  • jakubiakjakubiak Posts: 311 ✭✭✭

    Can you handle the repeating elements by create individual assertions for each repeating node? You can do this by indexiing the XPath, like /repeatingElement[0], /repeatingElement[1], etc. Is there some reason that won't work?

  • reactancexlreactancexl Posts: 91

    yeah, I guess that would work but my repeating nodes are dynamic. It could be 2 or 5 times. If I can correlate the request to the response somehow, that should work. If I can correlate the response to the request somehow the index should be maintained.

  • reactancexlreactancexl Posts: 91

    All I included a attachment of my scenario. I get the data from excel file, transform it and put the soap message in (XML DataBank Soap Message) tied to writeable (POCreatRequest). Another XML Databank (XML Data Bank Items) tied to writeable POCreateResponse which captures POUnitPrice. I send the data to the service and I am trying to validate the POUnitPrice in between Request soap message and the response soap message. It seems like for each POUnit price it validates both values. The response I get back is "Happy FLow" which there should not be any errors. Attached is my screenshots of tst case. thx

  • reactancexlreactancexl Posts: 91

    For now I took jakubiak advice on individual assertions as a interim solution whereas I create a column for each repeating node and it works. I would still like to see a solution where the number of repeating nodes are dynamic instead of "hardcoding" the index of the repeating nodes. thx

  • jakubiakjakubiak Posts: 311 ✭✭✭

    So the XPath that you are using finds multiple nodes, which is what you want, but it validates a single value against each of the nodes, which is not what you want. In this case I would probably just create a custom scripted assertion with the same XPath, and within the script use the values from the data source to validate the values.

Sign In or Register to comment.