jeudi 13 décembre 2018

XPath select only one node from multiple randomly

In SOAPUI i have a JDBC Request step with the next result:

<Results>
    <ResultSet fetchSize="10">
        <Row rowNumber="1">
            <CUSTOMER_ID>1963</CUSTOMER_ID>
            <ID>444</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>vitae consectetuer eget rutrum</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="2">
            <CUSTOMER_ID>4389</CUSTOMER_ID>
            <ID>6008</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>neque</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="3">
            <CUSTOMER_ID>8836</CUSTOMER_ID>
            <ID>5304</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>lectus suspendisse potenti</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="4">
            <CUSTOMER_ID>7360</CUSTOMER_ID>
            <ID>8279</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>at turpis a</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="5">
            <CUSTOMER_ID>823</CUSTOMER_ID>
            <ID>235</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>non interdum</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="6">
            <CUSTOMER_ID>5430</CUSTOMER_ID>
            <ID>4278</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>leo maecenas pulvinar</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="7">
            <CUSTOMER_ID>9209</CUSTOMER_ID>
            <ID>9974</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>ut suscipit</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="8">
            <CUSTOMER_ID>8135</CUSTOMER_ID>
            <ID>8296</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>lectus pellentesque eget</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="9">
            <CUSTOMER_ID>8247</CUSTOMER_ID>
            <ID>4569</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>vulputate nonummy</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
        <Row rowNumber="10">
            <CUSTOMER_ID>7156</CUSTOMER_ID>
            <ID>836</ID>
            <COMM_PRODUCT_ID>229</COMM_PRODUCT_ID>
            <DESCRIPTION>adipiscing molestie</DESCRIPTION>
            <STATUS>1</STATUS>
        </Row>
    </ResultSet>
</Results>

Custom Property: "ResponseAsXml"

And i have a Porperty Transfer with the next Source:

Source: JDBC Request

Property: ResponseAsXml

Path Language: XPath

Text box: Results/ResultSet/Row[1]/CUSTOMER_ID[1]

I need to get Row[Random node]/CUSTOMER_ID[1], (this is to avoid use the same customer in multiple test executions), but i don't know how is the sentence to get a random node.

Thanks in advance!

Julian.




Aucun commentaire:

Enregistrer un commentaire