jeudi 16 juillet 2020

Testing XML response

I'm trying to work out some testing on an XML response after a successful request as been sent. I'm using okhttp3, kotlin, and im using spek for my testing.

I'm not sure where to start, but I know I can use Reponse.Builder via okhttp and build out what I want my response to look like.

Here's the response I get back (fyi)

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <TrackReply xmlns="http://fedex.com/ws/track/v18">
            <HighestSeverity>SUCCESS</HighestSeverity>
                <TrackDetails>
                    <Notification>
                        <Severity>SUCCESS</Severity>
                        <Source>trck</Source>
                        <Code>0</Code>
                        <Message>Request was successfully processed.</Message>
                        <LocalizedMessage>Request was successfully processed.</LocalizedMessage>
                    </Notification>
                    <TrackingNumber>000000000</TrackingNumber>
                    <TrackingNumberUniqueIdentifier>00000000</TrackingNumberUniqueIdentifier>
                    <StatusDetail>
                        <CreationTime>0000000</CreationTime>
                        <Code>DL</Code>
                        <Description>Delivered</Description>
                        <Location>
                            <City>Lorem</City>
                            <StateOrProvinceCode>Lorem</StateOrProvinceCode>
                            <CountryCode>LR</CountryCode>
                            <CountryName>LR</CountryName>
                            <Residential>false</Residential>
                        </Location>
                    </StatusDetail>
                </TrackDetails>
            </CompletedTrackDetails>
        </TrackReply>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I'm parsing the response and storing the details within StatusDetail/Code/DL/Code/StatusDetail

Any ideas on how or where to start?

Aucun commentaire:

Enregistrer un commentaire