我正在SOAP工具中进行数据驱动的测试。我使用的是一个excel工作表,在这里我放置了数据。我使用DATASOURCE和DATASOURCE循环步骤在SOAP工具中获取数据。如果xml节点在请求中只有一个值,我就能够成功地做到这一点。
示例:具有单个值的xml节点
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header/>
<soap:Body>
<tem:GetOrders>
<tem:externalOrderID>OME68491990</tem:externalOrderID>
</tem:GetOrders>
</soap:Bosdy>
</soap:Envelope>如果xml节点有多个值,那么我将面临问题,下面的示例有很多值。
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header/>
<soap:Body>
<tem:CreateOrders>
<!--Optional:-->
<tem:xml><![CDATA[<QuickOrderDS> <QuickOrderDT> <CustomerPalletGrouping>119764</CustomerPalletGrouping> <TMLoadId>54034962</TMLoadId> <OriginId>3536</OriginId> <CustomerInvoiceReference1>20130500007</CustomerInvoiceReference1> <ManufacturingFacilityID>3536</ManufacturingFacilityID> <DestinationID>170077</DestinationID> <DestinationName></DestinationName> <DestinationAddress1>1000 WINDHAM PKWY</DestinationAddress1> <DestinationAddress2></DestinationAddress2> <DestinationCity>BOLINGBROOK</DestinationCity> <DestinationState>IL</DestinationState> <DestinationZip>60490-3507</DestinationZip> <BillofLading>1</BillofLading> <Weight>2360</Weight> <Pieces>1628</Pieces> <Pallets>2</Pallets> <TransportationDueFrom>2014-05-04T00:00:00</TransportationDueFrom> <TransportationDueThru>2014-06-05T00:00:00</TransportationDueThru> <Event>AMEX 25701 D1</Event> <Bundles>0</Bundles> <Version>11</Version> <ManufacturingJobNo>25701</ManufacturingJobNo> <CORPORATENUMBER>0000697364</CORPORATENUMBER> <BILLTONUMBER>00012</BILLTONUMBER> <ReShipID>0</ReShipID> <DateDriver>C</DateDriver> <ServiceType>Dropship</ServiceType> <CommodityTypeId>5</CommodityTypeId> <ModifiedUserId>NA\cg019647</ModifiedUserId> <Containerization>Trays on Pallets</Containerization> <ContentOwnerID>128</ContentOwnerID> <ContentID>4205</ContentID> <RRDLProcessingCF>8</RRDLProcessingCF> <CustomerConsigneeName>Mail Service</CustomerConsigneeName> </QuickOrderDT></QuickOrderDS>]]></tem:xml>
<tem:partialCommit>true</tem:partialCommit>
</tem:CreateOrders>
</soap:Body>
</soap:Envelope>有谁能帮我处理这件事吗。在这种情况下,如何使用soap中的excel工作表进行数据驱动的测试?
发布于 2014-11-12 16:32:13
这听起来没什么问题吗?只需使用与单个值相同的解决方案,并对其进行扩展。
如果您想要不同的东西,那么您有以下选项:
<tem:xml><![CDATA[<QuickOrderDS><QuickOrderDT><CustomerPalletGrouping>${datasource#prop1}</CustomerPalletGrouping><TMLoadId>${datasource#prop2}</TMLoadId>...</QuickOrderDT></QuickOrderDS>]]></tem:xml>MarkupBuilder() 这里。不要忘记,在SOAP消息中,CDATA中的所有内容本质上都是一个字符串,尽管在您看来它可能类似于XML。只有接收服务器将其解释为XML。
https://stackoverflow.com/questions/26880284
复制相似问题