Forum Discussion

ME_Bank_Support's avatar
ME_Bank_Support
Occasional Contributor
12 years ago

Comparing XML responses.

Hello

I started a Soap project where we need to do like to like system testing between two systems. I need to compare the response from the source to the response that i get from the target system.

what i did:

I created a Test suit that generates both the responses.
I created a groovy script to capture both the responses
def responseTAR = context.expand( '${getEntityAccounts - XTS#Response}' )
def responsesrc1 = context.expand( '${getEntityAccounts - Request 1#Response}' )

What i need to do:

I need to parse the Response XML
store each node in a variable
check whether its existing in the target response.

As i am doing this as data driven i need to write an assertion that the following test is pass or fail after comparison.

Say in the source system for the Get entity accounts request we get 4 accounts and in the target system we only got 3 accounts. the order the accounts appear may vary so i need to compare the first account that appears in the source XML (both acc no and BSB should be matched) to all the three accs that resulted from target for a match if there is a match i need to verify all the child attributes under that parent node.
sample nodes.