首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在RubyMine日志中验证Savon响应

如何在RubyMine日志中验证Savon响应
EN

Stack Overflow用户
提问于 2018-01-08 22:13:23
回答 1查看 131关注 0票数 0

我在RubyMine中运行Savon,在事件日志中有一个日志。有没有办法验证事件日志中的响应?

我正在运行的Soap调用成功,但响应包含标记,因此会影响其余的测试步骤。如果响应包含错误,有什么方法可以停止测试吗?

输入:

代码语言:javascript
复制
Globals: 
$soap_client_cumulus = Savon.client(
     wsdl: 'http://test.com/cumulus-ws/TestSoapService?wsdl',
     namespace: 'http://test.com/requests/cumulus/schema',
     env_namespace: :soapenv,
     namespace_identifier: :sch,
     pretty_print_xml: true,
     log: true,
     log_level: :debug,
     namespaces: {
    'xmlns:sch' => 'http://test.com/requests/cumulus/schema',
    'xmlns:draw' => 'http://test.com/data-dictionary/draw',
    'xmlns:priz' => 'http://test.com/data-dictionary/draw'})

And(/^I send the SOAP call 'close collection'$/) do
$soap_client_pymntmgr.call(:close_collection, message: {
    :"sch:collectionGroupId" => $group_id,
    :attributes! => {
        collectionGroupId: { 'xmlns' => 'http://test.com/requests/payment-manager/schema'}}})

我在日志中得到的回答是:

代码语言:javascript
复制
Testing started at 16:25 ...
C:\Ruby23-x64\bin\ruby.exe -EUTF-8 -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\Ruby23-x64\bin/cucumber C:/Users/vande/RegressieTest/DrawTest/features/07-Close_the_collection.feature --format Teamcity::Cucumber::Formatter --expand --color -r features
D, [2018-01-08T16:25:20.697496 #6680] DEBUG -- : HTTPI GET request to test.com (net_http)
I, [2018-01-08T16:25:20.887875 #6680]  INFO -- : SOAP request: http://test.com/payment-manager-ws/PaymentManagerSoapService
I, [2018-01-08T16:25:20.887875 #6680]  INFO -- : SOAPAction: "checkCollectionGroup", Content-Type: text/xml;charset=UTF-8, Content-Length: 445
D, [2018-01-08T16:25:20.888375 #6680] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sch="http://test.com/requests/manager/schema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <sch:checkCollectionGroupRequest>
      <sch:collectionGroupId>22422</sch:collectionGroupId>
    </sch:checkCollectionGroupRequest>
  </soapenv:Body>
</soapenv:Envelope>

D, [2018-01-08T16:25:20.898887 #6680] DEBUG -- : HTTPI POST request to test.com (net_http)
I, [2018-01-08T16:25:21.604963 #6680]  INFO -- : SOAP response (status 200)
D, [2018-01-08T16:25:21.605460 #6680] DEBUG -- : <?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <checkCollectionGroupResponse xmlns:ns6="http://test.com/data-dictionary/ticket" xmlns:ns5="http://test.com/data-dictionary/draw" xmlns:ns4="http://test.com/data-dictionary/prize" xmlns:ns3="http://test.com/data-dictionary/common" xmlns:ns2="http://test.com/data-dictionary/client" xmlns="http://test.com/requests/manager/schema">
      <success>false</success>
      <error>
        <code>10523</code>
        <message>Collection group is already closed.</message>
      </error>
    </checkCollectionGroupResponse>
  </soap:Body>
</soap:Envelope>

SOAP调用不会失败,但仍会返回错误。有没有一种方法可以验证/期望响应日志中的某个值?

EN

回答 1

Stack Overflow用户

发布于 2018-01-09 17:18:28

最终答案:

代码语言:javascript
复制
  response = $soap_client_pymntmgr.call(:check_collection_group, message: {
      :"sch:collectionGroupId" => $group_id,
      :attributes! => {
          collectionGroupId: { 'xmlns' => 'http://test.com/requests/manager/schema'}}})


  groupresponse = response.body[:check_collection_group_response][:success]

  expect(groupresponse).to eq("true")
  end
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48152079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档