[LoadRunner]性能测试实践_Hessian协议脚本编写
第一步,新建LR的脚本,选择Java Vuser协议:
第二步,编写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类(这步很关键):
最新文章
- jQuery.eq() 函数
- nodejs在Liunx上的部署生产方式-PM2
- 服务器知识----IIS架设问题
- 菜菜CPP日记
- Dos
- druid简介
- bmp格式解析
- java createSQLQuery().list()返回日期格式没有时分秒的解决方法
- SQL技术内幕三
- 【elasticsearch】(4)centos7 超简单安装elasticsearch 的 jdbc
- 使用wireshark抓本机之间的包(转)
- Windows as a Service(3)——使用SCCM管理Windows10更新
- SDP(3):ScalikeJDBC- JDBC-Engine:Fetching
- 如何查看ubuntu系统版本信息
- git 学习(3) ----- 代码共享和多人协作
- Git push提交时报错Permission denied(publickey)...Please make sure you have the correct access rights and the repository exists.
- php 开启 opcache 之后 require、include 还会每次都重新加载文件吗?
- spring动态创建数据源
- POJ 1751 Highways 【最小生成树 Kruskal】
- nginx安装扩展 sub_filter&;http_ssl_module