51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1864|回复: 0
打印 上一主题 下一主题

[原创] 为什么我的loadrunner安装之后,选择协议进去录制不了脚本

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-10-13 18:39:47 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
我用lr中的sample(机票预定系统)的录制了一段脚本,并加入了事务和集合点如下:、

Action()
{

        lrd_init(&InitInfo, DBTypeVersion);
        lrd_open_context(&Ctx1, LRD_DBTYPE_ODBC, 0, 0, 0);
        lrd_alloc_connection(&Con1, LRD_DBTYPE_ODBC, Ctx1, 0 /*Unused*/, 0);
        lrd_db_option(Con1, OT_ODBC_TXN_READ_COMMITTED, 0, 0);
        lrd_db_option(Con1, OT_ODBC_AUTOCOMMIT, "OFF", 0);
        lrd_open_connection(&Con1, LRD_DBTYPE_ODBC, "", lr_decrypt("452c67ebe"), "Quadbase", lr_decrypt("452c67ebe"), Ctx1, 0, 0);
        lrd_open_cursor(&Csr1, Con1, 0);

        lrd_stmt(Csr1, "SELECT agent_name FROM AGENTS ORDER BY agent_name", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr1, BCInfo_D2, 0);
        lrd_fetch(Csr1, -8, 1, 0, PrintRow2, 0);
        GRID(2);
        lrd_close_cursor(&Csr1, 0);
        lr_think_time(11);

        lrd_open_cursor(&Csr2, Con1, 0);
        lrd_stmt(Csr2, " SELECT DISTINCT departure FROM Flights ORDER BY departure ", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr2, BCInfo_D4, 0);
        lrd_fetch(Csr2, -5, 1, 0, PrintRow4, 0);
        GRID(4);
        lrd_close_cursor(&Csr2, 0);
        lr_think_time(14);

        lrd_open_cursor(&Csr3, Con1, 0);
        lrd_stmt(Csr3, "SELECT departure, flight_number, departure_initials, day_of_week, "
        "arrival_initials, arrival, departure_time, arrival_time, "
        "airlines, seats_available, ticket_price, mileage   FROM  "
        "Flights WHERE arrival = 'Portland' AND departure = 'Denver' "
        "AND day_of_week = 'Wednesday'ORDER BY flight_number ", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr3, BCInfo_D17, 0);
        lrd_fetch(Csr3, -5, 1, 0, PrintRow6, 0);
        GRID(6);
        lrd_close_cursor(&Csr3, 0);
        lr_think_time(17);

        lrd_open_cursor(&Csr4, Con1, 0);
        lrd_stmt(Csr4,
        "UPDATE Counters SET counter_value=counter_value+1 WHERE table_name='ORDERS'", -1, 1, 0 /*None*/, 0);
        lrd_close_cursor(&Csr4, 0);
        lrd_open_cursor(&Csr5, Con1, 0);
        lrd_stmt(Csr5, "SELECT counter_value FROM Counters WHERE table_name='ORDERS'", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr5, BCInfo_D19, 0);
        lrd_fetch(Csr5, 1, 1, 0, PrintRow8, 0);
        GRID(8);
        lrd_close_cursor(&Csr5, 0);
        lrd_open_cursor(&Csr6, Con1, 0);
        lrd_stmt(Csr6, "SELECT customer_no FROM Customers WHERE customer_name='hy'", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr6, BCInfo_D21, 0);
        lrd_fetch(Csr6, 0, 1, 0, PrintRow10, 0);
        /*Note:  no rows returned by above lrd_fetch*/

        lrd_close_cursor(&Csr6, 0);
        lrd_open_cursor(&Csr7, Con1, 0);
        lrd_stmt(Csr7,
        "UPDATE Counters SET counter_value=counter_value+1 WHERE table_name='CUSTOMERS'", -1, 1, 0 /*None*/, 0);
        lrd_close_cursor(&Csr7, 0);
        lrd_open_cursor(&Csr8, Con1, 0);
        lrd_stmt(Csr8, "SELECT counter_value FROM Counters WHERE table_name='CUSTOMERS'", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr8, BCInfo_D23, 0);
        lrd_fetch(Csr8, 1, 1, 0, PrintRow12, 0);
        GRID(12);
        lrd_close_cursor(&Csr8, 0);
        lrd_open_cursor(&Csr9, Con1, 0);



        lr_rendezvous("insertjhd");

        lr_start_transaction("insert_hy");

        lrd_stmt(Csr9, "INSERT INTO Customers (customer_name,customer_no) VALUES ('hy', 38)", -1, 1, 0 /*None*/, 0);


        lr_end_transaction("insert_hy", LR_AUTO);

        lrd_close_cursor(&Csr9, 0);
        lrd_open_cursor(&Csr10, Con1, 0);
        lrd_stmt(Csr10, "SELECT agent_no FROM Agents WHERE agent_name='Amanda'", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr10, BCInfo_D25, 0);
        lrd_fetch(Csr10, 1, 1, 0, PrintRow14, 0);
        GRID(14);
        lrd_close_cursor(&Csr10, 0);
        lrd_open_cursor(&Csr11, Con1, 0);



        lr_rendezvous("insertinto");

        lr_start_transaction("inser_hy");

        lrd_stmt(Csr11, "INSERT INTO Orders (order_number,agent_no,customer_no,flight_number,"
        "departure_date,tickets_ordered,class,"
        "send_signature_with_order) VALUES (108, 6, 38, 1492, {d "
        "'2006-10-11'}, 1, '3', 'N')", -1, 1, 0 /*None*/, 0);


        lr_end_transaction("inser_hy", LR_AUTO);

        lrd_close_cursor(&Csr11, 0);
        lrd_open_cursor(&Csr12, Con1, 0);
        lrd_stmt(Csr12, "COMMIT", -1, 1, 0 /*None*/, 0);
        lrd_close_cursor(&Csr12, 0);
        lr_think_time(18);

        lrd_open_cursor(&Csr13, Con1, 0);
        lrd_stmt(Csr13, "SELECT customer_no, agent_no FROM Orders WHERE order_number=108", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr13, BCInfo_D28, 0);
        lrd_fetch(Csr13, 1, 1, 0, PrintRow16, 0);
        GRID(16);
        lrd_close_cursor(&Csr13, 0);
        lrd_open_cursor(&Csr14, Con1, 0);
        lrd_stmt(Csr14, "DELETE FROM Orders WHERE order_number=108", -1, 1, 0 /*None*/, 0);
        lrd_close_cursor(&Csr14, 0);
        lrd_open_cursor(&Csr15, Con1, 0);
        lrd_stmt(Csr15, "SELECT COUNT(customer_no) FROM Orders WHERE customer_no=38", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr15, BCInfo_D30, 0);
        lrd_fetch(Csr15, 1, 1, 0, PrintRow18, 0);
        GRID(18);
        lrd_close_cursor(&Csr15, 0);
        lrd_open_cursor(&Csr16, Con1, 0);
        lrd_stmt(Csr16, "DELETE FROM Customers WHERE customer_no=38", -1, 1, 0 /*None*/, 0);
        lrd_close_cursor(&Csr16, 0);
        lrd_open_cursor(&Csr17, Con1, 0);
        lrd_stmt(Csr17, "SELECT COUNT(agent_no) FROM Orders WHERE agent_no=6", -1, 1, 0 /*None*/, 0);
        lrd_bind_cols(Csr17, BCInfo_D32, 0);
        lrd_fetch(Csr17, 1, 1, 0, PrintRow20, 0);
        GRID(20);
        lrd_close_cursor(&Csr17, 0);
        lrd_open_cursor(&Csr18, Con1, 0);
        lrd_stmt(Csr18, "COMMIT", -1, 1, 0 /*None*/, 0);
        lrd_close_cursor(&Csr18, 0);
        return 0;
}
创建方案是用手工方案,10个虚拟用户,迭代10次,在Controllerl中运行,结果如下:
Action.c(20): lrd_stmt:  SELECT DISTINCT departure FROM Flights ORDER BY departure  
Action.c(21): lrd_bind_col: Column=1
Denver
Los Angeles
Portland
San Francisco
Seattle
Action.c(22): lrd_fetch: 5 row(s) fetched (no more data)
Action.c(25): lr_think_time: 14.00 seconds.
Action.c(28): lrd_stmt: SELECT departure, flight_number, departure_initials, day_of_week, arrival_initials, arrival, departure_time, arrival_time, airlines, seats_available, ticket_price, mileage   FROM  Flights WHERE arrival = 'Portland' AND departure = 'Denver' AND day_of_week = 'Wednesday'ORDER BY flight_number  
Action.c(33): lrd_bind_col: Column=1
Action.c(33): lrd_bind_col: Column=2
Action.c(33): lrd_bind_col: Column=3
Action.c(33): lrd_bind_col: Column=4
Action.c(33): lrd_bind_col: Column=5
Action.c(33): lrd_bind_col: Column=6
Action.c(33): lrd_bind_col: Column=7
Action.c(33): lrd_bind_col: Column=8
Action.c(33): lrd_bind_col: Column=9
Action.c(33): lrd_bind_col: Column=10
Action.c(33): lrd_bind_col: Column=11
Action.c(33): lrd_bind_col: Column=12
Denver, 1492, DEN, Wednesday, POR, Portland,01:59 PM, 03:40 PM, TWA, 250, 146, 1292
Denver, 4659, DEN, Wednesday, POR, Portland,03:11 PM, 04:52 PM, TWA, 250, 128, 4459
Denver, 5237, DEN, Wednesday, POR, Portland,05:35 PM, 07:16 PM, TWA, 250, 149, 5037
Denver, 5471, DEN, Wednesday, POR, Portland,07:59 AM, 09:40 AM, TWA, 250, 135, 5271
Denver, 7563, DEN, Wednesday, POR, Portland,12:47 PM, 02:28 PM, TWA, 250, 145, 7363
Action.c(34): lrd_fetch: 5 row(s) fetched (no more data)
Action.c(37): lr_think_time: 17.00 seconds.
Action.c(40): lrdb_stmt:  "SQLExecDirect", return-code=-1, native-error-code=-1038, SQLState=40001, SQLError=[Quadbase][ODBC Driver][QBSERVER]
Number of records updated: 0
Time out waiting for locks

Action.c(40): lrd_stmt: ERROR, return-code=LRDE2009.  UPDATE Counters SET counter_value=counter_value+1 WHERE table_name='ORDERS'
Abort was called from an action.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
请问这个错误是什么原因?怎么解决。请各位大侠帮帮忙,不胜感激?另外,本人刚学,不知有没有别的好的学习方法,请大家指点。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-11-15 13:31 , Processed in 0.063604 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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