How to verify part of a Big XML Response in Parasoft

RoyRoy Posts: 6
edited June 2017 in SOAtest

I am trying to verify all the Event details in following XML where date is 01/06/2002. I don't want to use the normal value assertion as it needs me to create around 170 assertions.
The response looks like below:

<Body>
    <WorkResponse>
           <Name>ABC</Name>
           <ORG>XYZ</ORG>
           <Event>
               <Action>Transfer</Action>
               <Status>Dopen</Status>
               <Date>02/06/2017</Date>
            </Event>
            <Event>
                <Action>Update</Action>
                <Status>Dopen</Status>
                <Date>02/06/2017</Date>
            </Event>
              .
              .
              .
              <Event>
                  <Action>Split</Action>
                  <Status>Dopen</Status>
                  <Date>01/06/2002</Date>
              </Event>
              .
              .
              .
              <Event>
                  <Action>Create</Action>
                  <Status>Dopen</Status>
                  <Date>01/06/2002</Date>
               </Event>
   </WorkResponse>
</Body>

Can anyone please help me to understand how this can be done more effectively?

Tagged:

Comments

  • OmarROmarR Posts: 206 admin

    Welcome Roy,

    One approach would be to use a Text Data Bank to extract and store the specific section you wish to verify in your response. You may then add a stand-alone Diff tool to your test suite and pass the variable in the Regression Control tab.

  • OmarROmarR Posts: 206 admin

    Alternatively,

    You may use an xml transformer to transform your response XML to only contain the desired content. You can then pass the extracted content through a diff tool for verification. This method is a bit more elegant than the first.

  • benken_parasoftbenken_parasoft Posts: 552 ✭✭✭
    edited June 2017

    Instead of manually adding and configuring a Diff tool, I recommend setting up the regression control automatically. On the test node, right-click then click "Create/Update Regression Control", expand "Create Regression Control", then click the option to create either Internal or External regression control. For large XML documents, I recommend creating an external regression control.

    If there are elements/attributes/values in the XML document you want the regression control to ignore then you can also configure this automatically. There is an example in the SOAtest tutorial under "Service Functional Testing" > "Excluding Dynamic Values from Diff Comparisons".

  • RoyRoy Posts: 6

    Thank you all for the help. It worked for me.

Sign In or Register to comment.