自己弄的一个脚本,记录下,供以后参考。
Action()
{
web_add_cookie("citycode=310000; DOMAIN=testya.gewala.net");
web_url("login.xhtml",
"URL=http://testya.gewala.net/login.xhtml?TARGETURL=/cinema/searchOpi.xhtml",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTTP",
LAST);
web_url("loadSubjectHead.xhtml",
"URL=http://testya.gewala.net/ajax/common/loadSubjectHead.xhtml?tagNo=1359523577500814558&head=header",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/login.xhtml?TARGETURL=/cinema/searchOpi.xhtml",
"Snapshot=t17.inf",
"Mode=HTTP",
LAST);
web_url("getCaptchaId.xhtml",
"URL=http://testya.gewala.net/getCaptchaId.xhtml?r=1359523585968",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/login.xhtml?TARGETURL=/cinema/searchOpi.xhtml",
"Snapshot=t19.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url("captcha.xhtml",
"URL=http://testya.gewala.net/captcha.xhtml?captchaId=CiQwFXdgQBHuJLt7cb708617&r=1359523586046",
"Resource=1",
"RecContentType=image/jpeg",
"Referer=http://testya.gewala.net/login.xhtml?TARGETURL=/cinema/searchOpi.xhtml",
"Snapshot=t21.inf",
LAST);
web_concurrent_end(NULL);
//获取电影id
web_reg_save_param("test_movieIds",
"LB=id=\"",
"RB=\" rel=\"smovieid",
"ORD=ALL",
"NotFound=WARNING",
"Search=Body",
LAST);
web_submit_data("check_user.xhtml",
"Action=http://testya.gewala.net/cas/check_user.xhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/login.xhtml?TARGETURL=/cinema/searchOpi.xhtml",
"Snapshot=t22.inf",
"Mode=HTTP",
ITEMDATA,
"Name=TARGETURL", "Value=/cinema/searchOpi.xhtml", ENDITEM,
"Name=j_username", "Value={username}", ENDITEM,
"Name=j_password", "Value={passwd}", ENDITEM,
"Name=captchaId", "Value=CiQwFXdgQBHuJLt7cb708617", ENDITEM,
"Name=captcha", "Value=drkj", ENDITEM,
LAST);
if(atoi(lr_eval_string("{test_movieIds_count}")) == 0){
return 0;
}
lr_save_string(lr_eval_string(lr_paramarr_random("test_movieIds")),"testmovieId");
lr_log_message("testmovieId is %s",lr_eval_string("{testmovieId}"));
//lr_think_time(3);
//获取mpid
web_reg_save_param("test_mpIds",
"LB=href=\"/cinema/order/step1.shtml?mpid=",
"RB=\" class=\"button minBt redBt",
"ORD=ALL",
"NotFound=ERROR",
"Search=Body",
LAST);
web_url("searchOpi.xhtml_2",
"URL=http://testya.gewala.net/cinema/searchOpi.xhtml?movieid={testmovieId}&cinemaid=&fyrq=&spkey=&edition=&language=&cinemaname=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t47.inf",
"Mode=HTTP",
LAST);
lr_save_string(lr_eval_string(lr_paramarr_random("test_mpIds")),"testmpid");
lr_log_message("testmpid is %s",lr_eval_string("{testmpid}"));
web_url("loadSubjectHead.xhtml_4",
"URL=http://testya.gewala.net/ajax/common/loadSubjectHead.xhtml?tagNo=1359523611578634561&head=header",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/cinema/searchOpi.xhtml?movieid={testmovieId}&cinemaid=&fyrq=&spkey=&edition=&language=&cinemaname=",
"Snapshot=t48.inf",
"Mode=HTTP",
LAST);
web_url("getCountyBooking.xhtml_3",
"URL=http://testya.gewala.net/movie/ajax/getCountyBooking.xhtml?movieid={testmovieId}",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/cinema/searchOpi.xhtml?movieid={testmovieId}&cinemaid=&fyrq=&spkey=&edition=&language=&cinemaname=",
"Snapshot=t49.inf",
"Mode=HTTP",
LAST);
web_url("getIndexOtherRandomAd.xhtml_3",
"URL=http://testya.gewala.net/ajax/common/getIndexOtherRandomAd.xhtml?pid=ticketorder&tag=movie&relatedid={testmovieId}",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/cinema/searchOpi.xhtml?movieid={testmovieId}&cinemaid=&fyrq=&spkey=&edition=&language=&cinemaname=",
"Mode=HTTP",
LAST);
lr_start_transaction("order_begin");
//判断场次是否有效
web_reg_save_param("test_mpok",
"LB=<div class=\"backMsg\"",
"RB=/div>",
"NotFound=WARNING",
"Search=Body",
LAST);
web_url("step1.shtml",
"URL=http://testya.gewala.net/cinema/order/step1.shtml?mpid={testmpid}",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/cinema/searchOpi.xhtml?movieid={testmovieId}&cinemaid=&fyrq=&spkey=&edition=&language=&cinemaname=",
"Snapshot=t50.inf",
"Mode=HTTP",
LAST);
lr_log_message("testmpok is %s",lr_eval_string("{test_mpok}"));
if (strcmp(lr_eval_string ("{test_mpok}"), ">场次不存在!<") != 0){
web_concurrent_start(NULL);
web_url("captcha.xhtml_2",
"URL=http://testya.gewala.net/captcha.xhtml?captchaId=mx3QsWqgUxJYJpbV8d9e4089&r=0.6162794590989227",
"Resource=1",
"RecContentType=image/jpeg",
"Referer=http://testya.gewala.net/cinema/order/step1.shtml?mpid={testmpid}",
"Snapshot=t56.inf",
LAST);
web_concurrent_end(NULL);
web_url("loadSubjectHead.xhtml_5",
"URL=http://testya.gewala.net/ajax/common/loadSubjectHead.xhtml?tagNo=1359523617171583441&head=header",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/cinema/order/step1.shtml?mpid={testmpid}",
"Snapshot=t59.inf",
"Mode=HTTP",
LAST);
web_url("getIndexOtherRandomAd.xhtml_4",
"URL=http://testya.gewala.net/ajax/common/getIndexOtherRandomAd.xhtml?pid=ticketorder&tag=movie&relatedid={testmovieId}",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/cinema/order/step1.shtml?mpid={testmpid}",
"Mode=HTTP",
LAST);
//获取座位号
web_reg_save_param("test_ids",
"LB=<div id=",
"RB=hasSeat",
"ORD=ALL",
"SaveOffset=2",
"SaveLen=8",
"NotFound=WARNING",
"Search=Body",
LAST);
web_url("getSeatPage.shtml",
"URL=http://testya.gewala.net/ajax/ticket/getSeatPage.shtml?mpid={testmpid}&r=1359523617484",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/cinema/order/step1.shtml?mpid={testmpid}",
"Snapshot=t63.inf",
"Mode=HTTP",
LAST);
//int count_;
//count_ = atoi(lr_eval_string("{test_ids_count}"));
lr_log_message("count is %s",lr_eval_string("{test_ids_count}"));
if(atoi(lr_eval_string("{test_ids_count}")) > 0){
lr_save_string(lr_eval_string(lr_paramarr_random("test_ids")),"testSeatid");
lr_log_message("seatid is %s",lr_eval_string("{testSeatid}"));
lr_think_time(4);
web_reg_save_param("order_id",
"LB=\"retval\":\"",
"RB=\",\"success",
"NotFound=WARNING",
"Search=Body",
LAST);
web_reg_save_param("order_status",
"LB=success\":",
"RB=}",
"NotFound=WARNING",
"Search=Body",
LAST);
web_submit_data("step2.shtml",
"Action=http://testya.gewala.net/cinema/order/step2.shtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/cinema/order/step1.shtml?mpid={testmpid}",
"Snapshot=t64.inf",
"Mode=HTTP",
ITEMDATA,
"Name=goodsid", "Value=", ENDITEM,
"Name=quantity", "Value=1", ENDITEM,
"Name=mpid", "Value={testmpid}", ENDITEM,
"Name=seatid", "Value={testSeatid}", ENDITEM,
"Name=captchaId", "Value=mx3QsWqgUxJYJpbV8d9e4089", ENDITEM,
"Name=mobile", "Value=18721512675", ENDITEM,
"Name=captcha", "Value=aaaa", ENDITEM,
"Name=buynowBtn", "Value=立即购买", ENDITEM,
LAST);
lr_log_message("order_status : %s",lr_eval_string ("{order_status}"));
lr_log_message("order_id : %s",lr_eval_string ("{order_id}"));
if (strcmp(lr_eval_string ("{order_status}"), "true") == 0){
web_url("order.xhtml",
"URL=http://testya.gewala.net/gewapay/order.xhtml?orderId={order_id}",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t65.inf",
"Mode=HTTP",
LAST);
web_url("loadSubjectHead.xhtml_6",
"URL=http://testya.gewala.net/ajax/common/loadSubjectHead.xhtml?tagNo=1359523642234895568&head=header",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/gewapay/order.xhtml?orderId={order_id}",
"Snapshot=t72.inf",
"Mode=HTTP",
LAST);
web_submit_data("saveOrderInfo.xhtml",
"Action=http://testya.gewala.net/ajax/trade/saveOrderInfo.xhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/gewapay/order.xhtml?orderId={order_id}",
"Snapshot=t74.inf",
"Mode=HTTP",
ITEMDATA,
"Name=mobile", "Value=18721512675", ENDITEM,
"Name=orderId", "Value={order_id}", ENDITEM,
LAST);
web_url("confirmOrder.xhtml",
"URL=http://testya.gewala.net/gewapay/confirmOrder.xhtml?orderId={order_id}",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t75.inf",
"Mode=HTTP",
LAST);
web_url("loadSubjectHead.xhtml_7",
"URL=http://testya.gewala.net/ajax/common/loadSubjectHead.xhtml?tagNo=1359523650609193574&head=header",
"Resource=0",
"RecContentType=text/html",
"Referer=http://testya.gewala.net/gewapay/confirmOrder.xhtml?orderId={order_id}",
"Snapshot=t82.inf",
"Mode=HTTP",
LAST);
}//if (strcmp(lr_eval_string ("{order_status}"), "true") == 0)
}//if(atoi(lr_eval_string("{test_ids_count}") > 0)
}//if (strcmp(lr_eval_string ("{test_mpok}"), ">场次不存在!<") == 0)
lr_end_transaction("order_begin", LR_AUTO);
web_url("logout.xhtml",
"URL=http://testya.gewala.net/cas/logout.xhtml?ptn=smp",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t83.inf",
"Mode=HTTP",
LAST);
return 0;
}
相关推荐
【LoadRunner 录制和回放测试脚本(3)】 LoadRunner,作为业界领先的负载测试工具,由HP(现为Micro Focus)开发,旨在帮助软件开发者和测试工程师预测及评估应用程序在高负载条件下的性能。它通过模拟大量虚拟用户...
loadrunner性能测试脚本
loadrunner 性能测试脚本 黑白棋loadrunner 性能测试脚本 黑白棋loadrunner 性能测试脚本 黑白棋loadrunner 性能测试脚本 黑白棋loadrunner 性能测试脚本 黑白棋loadrunner 性能测试脚本 黑白棋loadrunner 性能测试...
【Loadrunner_脚本编程】是关于使用HP LoadRunner进行性能测试的重要主题,该软件是业界广泛使用的性能测试工具,能够模拟大量用户并发操作,从而评估应用系统的性能和稳定性。在脚本编程方面,LoadRunner提供了多种...
### LoadRunner创建测试脚本教程详解 #### 一、引言 LoadRunner 是一款由惠普公司开发的负载测试工具,广泛应用于软件性能测试领域。它可以帮助开发者和测试工程师模拟真实用户的行为,评估应用程序在压力下的表现...
【LoadRunner测试MySQL脚本】是使用HP的LoadRunner工具对MySQL数据库进行性能测试的一种方法。LoadRunner是一款功能强大的性能测试工具,它可以帮助我们评估和优化应用程序在高负载下的表现,确保系统的稳定性和可靠...
LoadRunner 创建测试脚本教程 LoadRunner 创建测试脚本教程是指使用 LoadRunner 软件来创建测试脚本的教程。 LoadRunner 是一款功能强大且广泛使用的性能测试工具,通过录制用户的操作生成测试脚本,模拟真实用户...
总的来说,LoadRunner脚本录制和代理录制是性能测试中的关键步骤,理解其工作原理并掌握问题解决技巧,对于提升测试效率和准确性有着积极的作用。结合Fiddler等辅助工具,可以应对更多复杂的录制场景,确保测试覆盖...
1. 录制测试脚本:通过Virtual User Generator,选择Web协议,开始录制用户在Mercury Tours(LoadRunner自带的示例应用)上的操作,如登录、浏览、预订等。 2. 测试结果:运行测试后,Controller会收集各种性能数据...
【LoadRunner录制与回放测试脚本详解】 LoadRunner,由HP公司开发,是一款功能强大的企业级负载测试工具,主要用于预测和评估系统在高负载下的性能表现。它通过模拟大量并发用户来验证系统的稳定性和可扩展性,确保...
### LoadRunner测试脚本知识点详解 #### 一、概述 在IT行业中,LoadRunner作为一款功能强大的性能测试工具,被广泛应用于系统负载测试与压力测试之中。本文将深入解析一个基于Java编写的LoadRunner测试脚本,该...
本文将详细介绍LoadRunner的性能测试原理、接口测试实例、脚本编写及结果分析。 1. **性能测试原理** 性能测试旨在确定系统在高负载下的性能表现,包括响应时间、吞吐量和资源利用率等关键指标。LoadRunner通过虚拟...
在入门部分,文章详细阐述了如何创建LoadRunner测试脚本。首先,开发者需要遵循录制脚本的原则,包括提高脚本执行效率,确保脚本内容精炼且反映真实用户行为;录制具有代表性的功能,选取常用且频率高的业务场景;...