zoukankan      html  css  js  c++  java
  • loadrunner压测java请求

    1、把应用jar包放到一个目录下,在lr中,引用导入系统里

    2、新建java vuser,写入脚本
    import com.alibaba.fastjson.JSONArray;
    import com.jd.jmi.order.api.domain.JmiOrderDetail;
    import com.jd.jmi.order.api.service.JmiOrderQueryService;
    import com.jd.jmi.order.client.jsf.exceptions.JmiException;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    import lrapi.lr;
    public class Actions
    {
            static JmiOrderQueryService jmiOrderQueryService;
        private static ApplicationContext act;
         static {
             act = new ClassPathXmlApplicationContext("spring-config-jsf.xml");
             jmiOrderQueryService = act.getBean("jmiOrderQueryService",JmiOrderQueryService.class);
             }
        public int init() throws Throwable { 
            return 0;
        }//end of init
        public int action() throws Throwable {
        lr.start_transaction("QueryByOrderId");
         try {
        JmiOrderDetail detail = this.jmiOrderQueryService.queryByOrderId(Long.valueOf(lr.eval_string("<OrderId>")), "eeeee");
        if (detail != null) {   
        lr.end_transaction("QueryByOrderId", lr.PASS);
        //System.out.println(JSONArray.toJSONString("++++++++++++++++"+detail));
        }else{
        lr.end_transaction("QueryByOrderId", lr.FAIL);
        }
        } catch (JmiException e) {
                e.printStackTrace();
            }
        return 0;
        }
        public int end() throws Throwable {
            return 0;
        }//end of end
    }

  • 相关阅读:
    Arduino Uno微控制器采用的是Atmel的ATmega328
    关于arduino与SPI
    fopen和fopen_s用法的比较
    C语言中 malloc
    补码原理——负数为什么要用补码表示
    晶振
    晶振(crystal)与谐振荡器(oscillator)
    LCD显示器缺陷自动化检测方案
    arduino 动态内存不足问题
    文档生成工具——Doxygen
  • 原文地址:https://www.cnblogs.com/upcgg/p/5220078.html
Copyright © 2011-2022 走看看