51Testing软件测试论坛
标题:
loadrunner 中java over http 协议怎样添加集合点 做过的朋友指点一下
[打印本页]
作者:
huashinaina
时间:
2012-7-11 12:56
标题:
loadrunner 中java over http 协议怎样添加集合点 做过的朋友指点一下
import com.thoughtworks.xstream.*;
import java.io.*;
import javaHttpJ.*;
import javaHttpJ.parsers.*;
import javaHttpJ.replay.*;
import lrapi.*;
public class Actions
{
public int init(){
return 0;
}
public int end(){return 0;}
public int action() throws Throwable{
String ENDFORM = "ENDFORM";
String LAST = "LAST";
String ENDITEM = "ENDITEM";
String ITEMDATA = "ITEMDATA";
String STARTHIDDENS = "STARTHIDDENS";
String ENDHIDDENS = "ENDHIDDENS";
String CONNECT = "CONNECT";
String RECEIVE = "RECEIVE";
String RESOLVE = "RESOLVE";
String REQUEST = "REQUEST";
String RESPONSE = "RESPONSE";
String EXTRARES = "EXTRARES";
int _webresult;
try{
lr.start_transaction("查看");
_webresult = lrapi.web.url("loading.gif",
"URL=http://192.168.0.120/oa/util/dialog/loading.gif", new String[]{
"Resource=1",
"RecContentType=image/gif",
"Referer=http://192.168.0.120/login/checkLoginAction.action",
"Snapshot=t17.inf",
LAST});
_webresult = lrapi.web.url("dialog.css",
"URL=http://192.168.0.120/oa/util/dialog/dialog.css", new String[]{
"Resource=1",
"RecContentType=text/css",
"Referer=http://192.168.0.120/login/checkLoginAction.action",
"Snapshot=t18.inf",
LAST});
_webresult = lrapi.web.url("title_bg_1.gif",
"URL=http://192.168.0.120/oa/util/dialog/title_bg_1.gif", new String[]{
"Resource=1",
"RecContentType=image/gif",
"Referer=http://192.168.0.120/login/checkLoginAction.action",
"Snapshot=t19.inf",
LAST});
_webresult = lrapi.web.url("tool_close.gif",
"URL=http://192.168.0.120/oa/util/dialog/tool_close.gif", new String[]{
"Resource=1",
"RecContentType=image/gif",
"Referer=http://192.168.0.120/login/checkLoginAction.action",
"Snapshot=t20.inf",
LAST});
_webresult = lrapi.web.url("EformAction.do",
"URL=http://192.168.0.120/oa/EformAction.do?actionType=open&instanceid=7645&nid=%nid%", new String[]{
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.0.120/login/checkLoginAction.action",
"Snapshot=t21.inf",
"Mode=HTML",
LAST});
_webresult = lrapi.web.submit_data("DataAction.do_2",
"Action=http://192.168.0.120/oa/eform/DataAction.do", new String[]{
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.0.120/oa/eform/DataAction.do?actionType=query&systemid=gongyongxinxi&subsysid=gongyongxinxi&modid=tztg",
"Snapshot=t22.inf",
"Mode=HTML",
}, new String[]{ // ITEM DATA
"Name=actionType", "Value=goto", ENDITEM,
"Name=doKey", "Value=", ENDITEM,
"Name=eformsysid", "Value=gongyongxinxi", ENDITEM,
"Name=eformsubsysid", "Value=gongyongxinxi", ENDITEM,
"Name=eformmodid", "Value=tztg", ENDITEM,
"Name=eformformid", "Value=tztg", ENDITEM,
"Name=eformflowid", "Value=", ENDITEM,
"Name=eformname", "Value=>> 鍏敤淇℃伅 >> 鍏敤淇℃伅 >> 閫氱煡閫氬憡", ENDITEM,
"Name=eformtype", "Value=B", ENDITEM,
"Name=eformactionid", "Value=", ENDITEM,
"Name=eformpkey", "Value=sno", ENDITEM,
"Name=eformtagid", "Value=", ENDITEM,
"Name=eformismulti", "Value=", ENDITEM,
"Name=eformtarget", "Value=", ENDITEM,
"Name=eformshowtype", "Value=", ENDITEM,
"Name=eformschema", "Value=none", ENDITEM,
"Name=eformqryarea", "Value=", ENDITEM,
"Name=eformsourceurl", "Value=", ENDITEM,
"Name=eformoptions", "Value=title0,faburen1,dept_name2,status3", ENDITEM,
"Name=eformorderby", "Value=", ENDITEM,
"Name=eformselection", "Value=", ENDITEM,
"Name=title0", "Value=", ENDITEM,
"Name=faburen1", "Value=", ENDITEM,
"Name=dept_name2", "Value=", ENDITEM,
"Name=status3", "Value=", ENDITEM,
"Name=dbgrid", "Value=", ENDITEM,
"Name=toPage", "Value=1", ENDITEM,
LAST});
_webresult = lrapi.web.submit_data("AjaxAction.do_2",
"Action=http://192.168.0.120/oa/AjaxAction.do", new String[]{
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.0.120/oa/eform/DataAction.do",
"Snapshot=t23.inf",
"Mode=HTML",
}, new String[]{ // ITEM DATA
"Name=actionType", "Value=query", ENDITEM,
"Name=timestamp", "Value=1341912984000", ENDITEM,
"Name=actionType", "Value=query", ENDITEM,
"Name=doKey", "Value=", ENDITEM,
"Name=eformsysid", "Value=gongyongxinxi", ENDITEM,
"Name=eformsubsysid", "Value=gongyongxinxi", ENDITEM,
"Name=eformmodid", "Value=tztg", ENDITEM,
"Name=eformformid", "Value=tztg", ENDITEM,
"Name=eformflowid", "Value=", ENDITEM,
"Name=eformname", "Value=>> 鍏敤淇℃伅 >> 鍏敤淇℃伅 >> 閫氱煡閫氬憡", ENDITEM,
"Name=eformtype", "Value=B", ENDITEM,
"Name=eformactionid", "Value=", ENDITEM,
"Name=eformpkey", "Value=sno", ENDITEM,
"Name=eformtagid", "Value=", ENDITEM,
"Name=eformismulti", "Value=", ENDITEM,
"Name=eformtarget", "Value=", ENDITEM,
"Name=eformshowtype", "Value=", ENDITEM,
"Name=eformschema", "Value=none", ENDITEM,
"Name=eformqryarea", "Value=", ENDITEM,
"Name=eformsourceurl", "Value=", ENDITEM,
"Name=eformoptions", "Value=title0,faburen1,dept_name2,status3", ENDITEM,
"Name=eformorderby", "Value=", ENDITEM,
"Name=eformselection", "Value=", ENDITEM,
"Name=title0", "Value=", ENDITEM,
"Name=faburen1", "Value=", ENDITEM,
"Name=dept_name2", "Value=", ENDITEM,
"Name=status3", "Value=", ENDITEM,
"Name=dbgrid", "Value=", ENDITEM,
"Name=toPage", "Value=1", ENDITEM,
"Name=rndval", "Value=1341912984278", ENDITEM,
LAST});
lr.end_transaction("查看",lr.AUTO);
}catch(Exception e){
e.printStackTrace();
return -1;
}
return 0;
}
}
以上是我的Action中脚本 我想做压力测试 请问哪位朋友可以指点一下啊
作者:
huashinaina
时间:
2012-7-11 17:45
回复
2#
xzf2001
随 :
try{
int lrapi.lr.rendezvous(string r name);
lr.start_transaction("查找");
_webresult = lrapi.web.url("loading.gif",
"URL=http://192.168.0.120/oa/util/dialog/loading.gif", new String[]{
"Resource=1",
"RecContentType=image/gif",
"Referer=http://192.168.0.120/login/checkLoginAction.action",
"Snapshot=t17.inf",
LAST});
我加上了 但是报错
C:\Documents and Settings\lina\桌面\性能测试\java over http 协议07101\Actions.java:40: 需要 ';'
int lrapi.lr.rendezvous(string r name);
^
1 错误
作者:
云层
时间:
2012-7-11 18:10
我在想一个问题,为啥要用java over http来写,看样子直接用http协议做不就行了
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2