lhp0523
发表于 2009-7-10 14:47:31
挺不错的~~
lele8662
发表于 2009-7-14 22:35:38
正晕着哩,楼主太善良了,3Q~~~
whoamiyaya
发表于 2009-10-13 22:12:40
后期分析确实很难,需要很多经验和积累,谢谢lz提供这样的思路,以后会参考,收藏:lol
siusinxy
发表于 2009-12-31 13:21:03
想问一下,用于测试的客户端的性能的瓶颈问题怎么确定?:)
lerry01
发表于 2010-6-29 21:05:36
不错,非常感谢!
nievslei
发表于 2010-6-30 09:50:19
open mind:victory:
youlan1301
发表于 2010-6-30 12:04:57
好东西,收藏
tingyu567
发表于 2010-6-30 15:52:14
非常好,谢谢楼主
lansechuiyan
发表于 2010-8-25 10:22:29
提问的多,补充的少,不过楼主的内容已经很好了!
zjx01206
发表于 2010-8-25 11:59:03
学习,学习,thanks
xuechangxu
发表于 2010-9-14 14:26:18
好,好,谢谢共享!
linda_4528
发表于 2011-2-25 20:09:36
学习~~!!!
soarsky629
发表于 2011-4-23 11:34:00
:victory:多谢杰楼主,刚好遇到一个问题不知道怎么解决
xangtianwen
发表于 2011-6-9 13:18:49
学习了,谢谢楼主!
wuwoyiran
发表于 2011-6-10 10:56:44
楼主真好人呀
shanglijuan1209
发表于 2011-6-17 10:58:43
感谢 学到蛮多!对分析有了大体的思路
thirfing
发表于 2011-6-21 16:20:54
好东西,学习了
honeyao
发表于 2012-2-5 16:59:19
顶~~
330254601
发表于 2012-2-25 17:12:10
/*
* LoadRunner Java script. (Build: 3020)
*
* Script Description:
*
*/
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.UUID;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import com.sun.org.apache.xpath.internal.operations.String;
import lrapi.lr;
public class Actions
{
public int init() throws Throwable {
return 0;
}//end of init
public int action() throws Throwable {
// TODO Auto-generated method stub
String username = "test01";
String url = "http://129.168.200.80/omm_spc";
String url2 = "http://129.168.200.80/omm_spc/security/InterceptLogin.do";
String url3 = "http://129.168.200.80/omm_spc/j_spring_security_check?j_username=ljw"+ username +
"&j_password=12345678&_spring_security_remember_me=null";
HttpClient client = new HttpClient();
String session_id;
session_id = WebLoginPage(client, url, url2, url3);
System.out.println(session_id);
String fileUuid = "11111111eeeeeee111111eeeee";
String downloadURL = "http://129.168.200.80/omm_spc/caseFile/download.do?fileUuid="+ fileUuid ;
GetMethod getDownLoad = new GetMethod(downloadURL);
getDownLoad.addRequestHeader("cookie", session_id);
//下载文件的保存路径
String filePath_down = "F:\\";
// 通过文件路径创建File对象,并作为参数传到文件下载模块中
File file = new File(filePath_down + UUID.randomUUID().toString());
int aaa = client.executeMethod(getDownLoad);
InputStream is = getDownLoad.getResponseBodyAsStream();
FileOutputStream fos = new FileOutputStream(file);
try {
byte[] buffer = new byte;
int read;
while (-1 != (read = is.read(buffer))) {
//fos.write(buffer, 0, read);
}
} finally {
is.close();
fos.close();
}
return 0;
}//end of action
public int end() throws Throwable {
return 0;
}//end of end
public String WebLoginPage(HttpClient client, String webLogin, String interceptLogin,
String redirectLogin) throws HttpException, IOException {
String session_id = null;
// 构造HttpClient的实例
// 创建GET方法的实例,模拟打开首页
GetMethod getLoginPage = new GetMethod(webLogin);
Header[] getLoginPageHeaders = null;
try {
int responseCode = client.executeMethod(getLoginPage);
getLoginPageHeaders = getLoginPage.getResponseHeaders();
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 在返回的cookie中获取session_id相关内容
String cook_session_id = null;
for (Header getLoginPageHeader : getLoginPageHeaders) {
if (getLoginPageHeader.getName().equals("Set-Cookie")) {
cook_session_id = getLoginPageHeader.getValue();
}
}
// 截取session_id
session_id = cook_session_id.split(";");
if (null == session_id) {
System.out.println("can't find session_id");
}
// 创建POST方法的实例,登陆
PostMethod interceptLoginPage = new PostMethod(interceptLogin);
interceptLoginPage.addRequestHeader("Cookie", session_id);
interceptLoginPage.addParameter("j_username", "admin");
interceptLoginPage.addParameter("j_username", "Admin@123");
client.executeMethod(interceptLoginPage);
// 创建POST方法的实例,重定向请求
GetMethod redirectLoginPage = new GetMethod(redirectLogin);
redirectLoginPage.addRequestHeader("Cookie", session_id);
int respanceCode = client.executeMethod(redirectLoginPage);
if (200 == respanceCode) {
System.out.println("login success");
}
return session_id;
}
}
merry08
发表于 2012-4-11 09:39:07
谢谢LZ,对于正在测试的我帮助很大。。