zoukankan      html  css  js  c++  java
  • Capturing Request and Response XML in log file

    转自:https://community.smartbear.com/t5/SoapUI-NG/Capturing-Request-and-Response-XML-in-log-file/td-p/15991

    Hello,

    There is a dump file property which captures the raw response data, but not the request. I think the easiest way of capturing both the request and the response is by writing a groovy script to do so. Add a Script TestStep after the Request with the following script:


    def timestamp = System.currentTimeMillis()
    def directory = "c:\dump"

    def requestFile = new File(directory, "request_${timestamp}.txt")
    requestFile.append( context.expand('${HTTP Test Request#Request}') )

    def responseFile = new File(directory, "response_${timestamp}.txt")
    responseFile.append( context.expand('${HTTP Test Request#Response}') )



    This will save each request and response to a separate file.

    Alternatively, if all you want to do is output them to the log, you can use:


    log.info context.expand('${HTTP Test Request#Request}')
    log.info context.expand('${HTTP Test Request#Response}')



    In either case, replace HTTP Test Request with the name of your TestStep name.

    Regards,
    Dain
    eviware.com

  • 相关阅读:
    About me
    新blog!!!
    卡常技巧
    考试策略
    Bzoj 1260: [CQOI2007]涂色paint (区间DP)
    Bzoj 1081 [Ahoi2009] chess 中国象棋
    NOIP2018 全国热身赛 第二场 (不开放)
    AT2386 Colorful Hats (乱搞题,思维题)
    模拟赛2
    CF873B Balanced Substring (前缀和)
  • 原文地址:https://www.cnblogs.com/z1500592/p/6769409.html
Copyright © 2011-2022 走看看