我已经创建了 Web 服务项目。以下是我的测试用例的脚本,它验证文档中显示的元素文本:
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
def response = WS.sendRequest(findTestObject('ProductById'))
WS.verifyElementText(response, "Product.Reference", "MyReference")
当我运行这个测试用例时,我收到了错误:[FAILED] - Unable to verify element text (Root cause: org.xml.sax.SAXParseException: Content is not allowed in prolog.)
然后我用:com.kms.katalon.core.util.KeywordUtil#logInfo
来查看response.responseText
我收到的,这是:
--uuid:4e39ea48-6560-46b7-a30c-201dfaf98f51
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getProductResponse xmlns:ns2="http://mycompany.com/"><Product><Reference>VW3A8306R</Reference></Product></ns2:getProductResponse></soap:Body></soap:Envelope>
--uuid:4e39ea48-6560-46b7-a30c-201dfaf98f51--
我正在测试的 Web 服务已MTOM
启用。这就是响应文本采用这种格式的原因。
在这种情况下如何创建测试用例?