空手道 0.9.1 为 SOAP 网络服务测试抛出异常



我正在尝试使用空手道 0.9.1 测试 soap 网络服务,我根据文档创建了场景。

但是,当我在测试场景中传递网络服务请求时测试 soap 网络服务时,我遇到了异常。

场景 : 1我通过了如下请求,

* def req=
""" 
  <?xml version='1.0' encoding='UTF-8'?>
  <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
  <ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
      <ns2:UsageBalance>
          <ns2:LicenseId>12341234</ns2:LicenseId>
      </ns2:UsageBalance>
  </ns2:QueryUsageBalance>
  </S:Body>
  </S:Envelope>
  """

结果

“[Fatal Error] :32:18: XML document structures must start and end within the same entity”

场景 : 2

Given request
""" 
  <?xml version='1.0' encoding='UTF-8'?>
  <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
  <ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
      <ns2:UsageBalance>
          <ns2:LicenseId>12341234</ns2:LicenseId>
      </ns2:UsageBalance>
  </ns2:QueryUsageBalance>
  </S:Body>
  </S:Envelope>
  """

结果

“[Fatal Error] :32:18: XML document structures must start and end within the same entity”

场景 : 3

Given request =
""" 
  <?xml version='1.0' encoding='UTF-8'?>
  <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
  <ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
      <ns2:UsageBalance>
          <ns2:LicenseId>12341234</ns2:LicenseId>
      </ns2:UsageBalance>
  </ns2:QueryUsageBalance>
  </S:Body>
  </S:Envelope>
  """

结果

Program execution freezes and no output

谁能帮助我了解我在这里做错了什么。

我在空手道 0.6.1 中使用相同的 xml,它工作正常。

只需将三引号放在单独的行上,您应该没问题:

* def req =
"""
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">    <ns2:UsageBalance>
<ns2:LicenseId>12341234</ns2:LicenseId>
</ns2:UsageBalance>
</ns2:QueryUsageBalance>
</S:Body>
</S:Envelope>
"""
* print req

我们曾要求用户测试测试版,但看起来您还没有看到它们:https://twitter.com/KarateDSL/status/1064375506202755073

无论如何,如果您仍然看到"冻结"之类的问题,请按照以下过程操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

最新更新