代码之家  ›  专栏  ›  技术社区  ›  JL. Hans Passant

Web服务单元测试

  •  1
  • JL. Hans Passant  · 技术社区  · 16 年前

    这是一个有趣的问题,我相信很多人都会从中受益。

    <orgUnits>
     <orgUnit>
         <name>friendly name</orgUnit>
     </orgUnit>
     <orgUnit>
         <name>friendly name</orgUnit>
     </orgUnit>
    </orgUnits>
    

    为了简化问题,在web服务方法中,如果发生任何错误,我会抛出SOAPException。

    2 回复  |  直到 16 年前
        1
  •  1
  •   Pradeep    16 年前

    WSDL Testing

    SoapUI 作为一个很好的工具使用

        2
  •  2
  •   Community Mohan Dere    9 年前

    1. 假设您期望从Web服务返回像expected.xml这样的返回。
    2. 调用服务并获取一个实际的对象。将其序列化为actual.xml。
    3. 使用以下库比较actual.xml和expected.xml xmldiff
    4. 根据xmldiff的输出确定Web服务是否通过了测试。