SoapUi groovy script property transfer if statment xml

22 Views Asked by At

I automating some tests and i need your help to do a groovy script to do property transfer if a field = value.

My XML exemple : i need to transfer the offerItemID when ServiceID == SR_YES

           <OfferItemID>wanted_id_1</OfferItemID>

           <Service>

                          <ServiceDetails>

                                        <PaxJourneyRefID>PJ1</PaxJourneyRefID>

                          </ServiceDetails>

           </Service>

           <Service>

                          <ServiceDetails>

                                        <ServiceDetailsRef>

                                                       <PSRID>S1</PSRID>

                                                       <ServiceID>SR_YES</ServiceID>

                                        </ServiceDetailsRef>

                          </ServiceDetails>

           </Service>
           <OfferItemID>not_id_1</OfferItemID>

           <Service>

                          <ServiceDetails>

                                        <PaxJourneyRefID>PJ1</PaxJourneyRefID>

                          </ServiceDetails>

           </Service>

           <Service>

                          <ServiceDetails>

                                        <ServiceDetailsRef>

                                                       <PSRID>S1</PSRID>

                                                       <ServiceID>SR_NO</ServiceID>

                                        </ServiceDetailsRef>

                          </ServiceDetails>

           </Service>

Thank you in advance for help.

A groovy script to do conditional property transfer on xml

0

There are 0 best solutions below