HsacAcceptanceTests.SlimTests.HttpTest.XmlHttpTest


library
stop test fixture

script mock xml server setup
add response
<dag/>
add response
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/><SOAP-ENV:Body>
<SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail></SOAP-ENV:Fault>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
with status 500
add response
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/><SOAP-ENV:Body>
<SOAP-ENV:Fault><faultcode>soapenv:Server</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail></SOAP-ENV:Fault>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
with status 500
add response
add response
<binary/>
$url<-[http://127.0.0.1:8000/FitNesseMock] get mock server url

script xml http test
check response time -1
post
<Hallo/>
to $url->[http://127.0.0.1:8000/FitNesseMock]
check xPath count(/dag) 1
check response time 2>0
reject post
<ClientFault/>
to $url->[http://127.0.0.1:8000/FitNesseMock]
show response
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Client</faultcode>
            <faultstring>Message does not have necessary info</faultstring>
            <faultactor>http://gizmos.com/order</faultactor>
            <detail>
                <PO:order xmlns:PO="http://gizmos.com/orders/">Quantity element does not have a value</PO:order>
                <PO:confirmation xmlns:PO="http://gizmos.com/confirm">Incomplete address: no zip code</PO:confirmation>
            </detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
check response status 500
check raw xPath /env:Envelope/env:Body/env:Fault/faultstring Message does not have necessary info
show response headers
Date Mon, 16 Mar 2020 07:47:31 GMT
Content-length 556
check response header Content-length 556
note next line is commented out so we won't have a real exception, uncomment to see that SOAP content is shown in exception
note check xPath /env:Envelope/env:Body/env:Fault/faultstring Message does not have necessary info
reject post
<ServerFault/>
to $url->[http://127.0.0.1:8000/FitNesseMock]
show response
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>soapenv:Server</faultcode>
            <faultstring>Message does not have necessary info</faultstring>
            <faultactor>http://gizmos.com/order</faultactor>
            <detail>
                <PO:order xmlns:PO="http://gizmos.com/orders/">Quantity element does not have a value</PO:order>
                <PO:confirmation xmlns:PO="http://gizmos.com/confirm">Incomplete address: no zip code</PO:confirmation>
            </detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
check response status 500
check raw xPath /env:Envelope/env:Body/env:Fault/faultstring Message does not have necessary info
note next line is commented out so we won't have a real exception, uncomment to see that SOAP content is shown in exception
note check xPath /env:Envelope/env:Body/env:Fault/faultstring Message does not have necessary info
reject post
<NoXml/>
to $url->[http://127.0.0.1:8000/FitNesseMock]
check response status 200
note we use StopTestFixture as library to abort the test if status code is not what we expect
$responseStatus<-[200] response status
stop test if $responseStatus->[200] is not 200
check response <no xml
note next line is commented out so we won't have a real exception, uncomment to see that non-XML content is shown in exception
note check xPath count(/*) 0



table: Mock Server Message Report
1 (of 5) request(s) did not match expectation
1

request

<Hallo/>

response

<dag/>
2

request

<ClientFault/>

response

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Client</faultcode>
            <faultstring>Message does not have necessary info</faultstring>
            <faultactor>http://gizmos.com/order</faultactor>
            <detail>
                <PO:order xmlns:PO="http://gizmos.com/orders/">Quantity element does not have a value</PO:order>
                <PO:confirmation xmlns:PO="http://gizmos.com/confirm">Incomplete address: no zip code</PO:confirmation>
            </detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
3

request

<ServerFault/>

response

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>soapenv:Server</faultcode>
            <faultstring>Message does not have necessary info</faultstring>
            <faultactor>http://gizmos.com/order</faultactor>
            <detail>
                <PO:order xmlns:PO="http://gizmos.com/orders/">Quantity element does not have a value</PO:order>
                <PO:confirmation xmlns:PO="http://gizmos.com/confirm">Incomplete address: no zip code</PO:confirmation>
            </detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
4

request

<NoXml/>

response

5No request received

response

<binary/>

script mock xml server setup
stop