zoukankan      html  css  js  c++  java
  • [LoadRunner]性能测试实践_Hessian协议脚本编写

    第一步,新建LR的脚本,选择Java Vuser协议:

    image

    第二步,编写hessian测试脚本,如下:

    import lrapi.lr;
    import java.net.MalformedURLException;
    import kf.ats.gvnsvr.common.service.base.IBaseTimeService;
    import com.caucho.hessian.client.HessianProxyFactory;

    public class Actions
    {
    private static final String postUrl = "http://192.168.2.161:18081/test/HS/";
    private static final String serverName="BaseTimeService";

    public int init() throws Throwable {

      return 0;
    }//end of init
     
     
    public int action() throws Throwable {

         lr.start_transaction("deal");
        

         HessianProxyFactory factory = new HessianProxyFactory();
         IBaseTimeService service;
         String result=null;
         try {
          service = (IBaseTimeService) factory.create(IBaseTimeService.class, postUrl + serverName);
          result=service.getCurrentTime().toString();
          System.out.println(result);
        } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
            }

         if (result!=null) {
      lr.end_transaction("deal", lr.PASS);
         } else {
      lr.end_transaction("deal", lr.FAIL);
         }
         return 0;
    }//end of action
     

    public int end() throws Throwable {

      return 0;
    }//end of end
    }

    第三步,导入必要的jar类(这步很关键):

    image

  • 相关阅读:
    0223_模拟2011
    0223_模拟2011
    0223_模拟2011
    0223_模拟2011
    12c DG broker DMON自动重启过程分析
    12c DG broker DMON自动重启过程分析
    12c DG broker DMON自动重启过程分析
    12c DG broker DMON自动重启过程分析
    CITA架构设计
    跨链合约示例
  • 原文地址:https://www.cnblogs.com/whylaughing/p/5430821.html
Copyright © 2011-2022 走看看