51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 4823|回复: 2
打印 上一主题 下一主题

[求助] loadrunner 中java over http 协议怎样添加集合点 做过的朋友指点一下

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2012-7-11 12:56:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1测试积点
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中脚本 我想做压力测试  请问哪位朋友可以指点一下啊

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2012-7-11 17:45:39 | 只看该作者
回复 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 错误
回复

使用道具 举报

该用户从未签到

3#
发表于 2012-7-11 18:10:53 | 只看该作者
我在想一个问题,为啥要用java over http来写,看样子直接用http协议做不就行了
回复

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-9 09:46 , Processed in 0.069429 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表