4.3.2.Writing first assertion

  • 1.Add a new assertion: XPath

    • 1.按下Declare紐, 帶入namespace

    • 2.填入期望值的路徑(XPath Expression)

      • e.g.,

        • 完整的response格式為

          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
           <soapenv:Body>
              <ns1:getBankResponse xmlns:ns1="http://thomas-bayer.com/blz/">
                 <ns1:details>
                    <ns1:bezeichnung>Postbank (Giro)</ns1:bezeichnung>
                    <ns1:bic>PBNKDEFF200</ns1:bic>
                    <ns1:ort>Hamburg</ns1:ort>
                    <ns1:plz>22280</ns1:plz>
                 </ns1:details>
              </ns1:getBankResponse>
           </soapenv:Body>
          </soapenv:Envelope>
        • 若想要抓bic的值, 應填入的路徑為

          //ns1:getBankResponse/ns1:details/ns1:bic
    • 3.下方填入期望值

    • 4.按下Test紐以測試

  • 2.用XPath計算某欄位的個數

  • 3.用XPath過濾某個欄位的值

Last updated

Was this helpful?