Тест почтальона не выполняется при анализе ответа мыла xml - PullRequest
0 голосов
/ 12 июня 2019

Я использую POSTMAN для отправки запроса SOAP, и ниже мой soapenv полученный ответ. Я хотел бы проверить приведенное ниже значение, полученное в моем тесте почтальона, но тест почтальона не пройден, может кто-нибудь посоветовать, что делать здесь?

LicStatus

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:schemas.general.com.au:api:other">
    <soapenv:Header xmlns:urn="urn:schemas.general.com.au:api:other" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <header xmlns:urn="urn:schemas.general.com.au:api:other" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.cordys.com/General/1.0/">
            <msg-id>005056B9-3921-A1E9-A327-64509F7362DC</msg-id>
            <messageoptions noreply="true"/>
        </header>
    </soapenv:Header>
    <soapenv:Body>
        <getSupplierDataResponse xmlns:urn="urn:schemas.general.com.au:api:other" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:schemas.general.com.au:api:other" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns6="http://schemas.cordys.com/default_005056B9-5D92-A1E9-904D-128C719CE2DD" xmlns:ns5="http://schemas.cordys.com/casemanagement/1.0" xmlns:ns4="http://schemas.XXTGGHG.org/2004/07/STRD.Models" xmlns:ns3="urn:schemas.general.com.au:canonical:technical:v1" xmlns:ns2="urn:schemas.general.com.au:api:other" xmlns:bpm="http://schemas.cordys.com/default" xmlns:sm="http://www.w3.org/2005/07/scxml" xmlns:instance="http://schemas.cordys.com/bpm/instance/1.0">
            <CustomerData>
                <DateLicenceExpires>28/01/2020</DateLicenceExpires>
                <Demonstration_Method>Certification</Demonstration_Method>
                <AuditLastAuditDate>05/03/2018</AuditLastAuditDate>
                <AuditOutcome>Non Compliance</AuditOutcome>
                <HeadOfficeRegion/>
                <ScopeOfLicencing>YES</ScopeOfLicencing>
                <LicStatus>Licensed</LicStatus>   
            </CustomerData>
            <OperationResult xmlns="urn:schemas.general.com.au:canonical:technical:v1">
                <Status>00</Status>
                <StatusMessage>Success</StatusMessage>
            </OperationResult>
        </getSupplierDataResponse>
    </soapenv:Body>
</soapenv:Envelope>

Ниже приведен тест почтальона:

pm.test('Verify the LicStatus', function() {
var responseJson = xml2Json(responseBody);
pm.expect(responseJson.results[0].LicStatus).to.eql("Licensed");

})

1 Ответ

1 голос
/ 12 июня 2019

Попробуйте что-то вроде этого:

pm.test('Verify the LicStatus', function() {
    var xmlTree = xml2Json(responseBody);
    var licenseStatus = xmlTree['soapenv:Envelope']['soapenv:Body'].getSupplierDataResponse.CustomerData.LicStatus;

    pm.expect(licenseStatus).to.eql("Licensed");
})
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...