zoukankan      html  css  js  c++  java
  • LoadRunner 函数之lr_xml_get_values

    简单实例如

    char *xml_input =
    "<?xml version="1.0" encoding="UTF-8"?>"
    "<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">"
      "<S:Body>"
        "<ns2:handleResponse xmlns:ns2="http://eaop.gd.chinamobile.com/">"
          "<return>"
            "<queryecouponsbymobilenumresp>"
              "<msgheader>"
                "<req_seq>20161206165439111</req_seq>"
                "<ope_seq>20161220161336177143</ope_seq>"
                "<retinfo>"
                  "<rettype>0</rettype>"
                  "<retcode>0</retcode>"
                  "<retmsg>success</retmsg>"
                "</retinfo>"
              "</msgheader>"
    		  "<msgbody>"
    		  "</msgbody>"
            "</queryecouponsbymobilenumresp>"
          "</return>"
        "</ns2:handleResponse>"
      "</S:Body>"
    "</S:Envelope>";
    
    Action(){
    	lr_save_string(xml_input, "XML_Input_Param"); // Save input as parameter
    	// lr_xml_get_values:Retrieves values of XML elements found by a query. 
        lr_xml_get_values("XML={XML_Input_Param}",
              "ValueParam=OutputParam",
              "Query=/Envelope/Body/handleResponse/return/queryecouponsbymobilenumresp/msgheader/retinfo/retcode",
              LAST );
        lr_output_message(lr_eval_string("Query result = {OutputParam}"));
    	return 0;
    }
    

    输入结果如


    ***微信扫一扫,关注“python测试开发圈”,了解更多测试教程!***
  • 相关阅读:
    C++ 日期 & 时间
    C++ 引用
    C++ 指针
    C++ 字符串
    C++ 数组
    C++ 数字
    C++ 函数
    C++ 判断
    C++ 循环
    C++ 运算符
  • 原文地址:https://www.cnblogs.com/guanfuchang/p/6203866.html
Copyright © 2011-2022 走看看