51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2157|回复: 16
打印 上一主题 下一主题

SP培训中的一道题解答,请老师帮忙看看

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-3-17 22:42:46 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
题目是这样的:
How would you modify the code below so that the transaction exit failed if it took longer than 2 minutes?
Code:
lr_start_transaction("exit");
web_url("MyApp","URL=http://MyApp.com",LAST);

lr_end_transaction("exit",?LR_AUTO);

给出的答案是:
lr_start_transaction("exit");
web_url("MyApp","URL=http://MyApp.com",LAST);
status=web_set_timerout("CONNECT","120");
if(status == LR_FAIL)
    lr_error_message("Error: %s", "Fail to connect within 2 minutes!");

lr_end_transaction("exit",LR_AUTO);

不太明白的地方是
1. 在该函数的帮助,函数“web_set_timeout()”意思为“Specifies the maximum amount of time that a Vuser waits for the specified operation to be performed",这里的CONNECT意为"To establish the connection to the Web server"。而web_url()函数是向server发送了一个GET请求,不仅仅是建立一个connection
2. 关于函数web_set_timeout()使用的地方,到底是放在要监控对象之前还是之后呢?
3. 这道题用函数对:lr_start_timer()和lr_end_timer()是不是更好点?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2006-3-19 11:44:30 | 显示全部楼层
谢谢pcl老师解答
当时我自己给出的答案是:
Action()
{
         double time_elapsed;
        merc_timer_handle_t timer;

        lr_start_transaction("exit");
        timer = lr_start_timer();
        web_url("MyApp","URL=http://MyApp.com",LAST);
        time_elapsed = lr_end_timer(timer);
        if(time_elapsed > 120)
                lr_end_transaction("exit",LR_FAIL);
        else
                lr_end_transaction("exit",LR_AUTO);
        return 0;
}
看了你的解释,我对函数web_set_timerout ()中第2个参数比较不明白了,那这个“CONNECT”和“RECEIVE”有什么差别阿?
还有一个问题:
在参考题目中:What appeared after you started the scenario run?
我对答案感到不太理解,run scenario后应该是controller控制load generator产生虚拟用户才对啊,而怎么会是弹出Start Delayed 对话框呢?
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2006-3-22 19:06:02 | 显示全部楼层
谢谢朴老师了!
我看到这道题的答案了,开始感觉不是很明白。后来在Schedule Builder-〉Scenario Start下设置了一个delay的时间点,这样才会在开始scenario后弹出答案中的对话框;可是如果没有设置这个delay的时间点的话,则会马上开始执行场景(而以前多采用的这种方式)
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2006-3-22 19:33:11 | 显示全部楼层
还有一个问题啊!
培训中有一个录制Mercury Tours脚本的题不是很明白:
找脚本中错误的地方。
我照着题目的要求自己录制了脚本,回放也是成功的。但是自己没有找出什么错误(最开始的时候也是怀疑是否是关联的问题,后来看回放也成功了,就想着关联应该是没有问题了)后来看了答案还不是不懂,请朴老师指点一二,呵呵!
回复 支持 反对

使用道具 举报

该用户从未签到

5#
 楼主| 发表于 2006-3-26 16:14:11 | 显示全部楼层
又有一道题不明白了:
题目是:Each business process takes a certain amount of time to complete. Under ideal conditions, you determine this amount of time is ___
给出的答案是:Preferred response time
对这个答案不是很清楚,好像在ld的帮助文档中也没有发现;当时我自己给出的答案是:transaction response time
请朴老师看看。
回复 支持 反对

使用道具 举报

该用户从未签到

6#
 楼主| 发表于 2006-3-29 11:13:32 | 显示全部楼层
第2个错误关于关联的,是清楚的,不明白的是第一个错误:
First error is in the basic script. On the list of available flights, even if the first listed
flight is selected by default in the Departing From table, you still need to record
clickin on it for the value to be captured and correlated when the cities are parameterized
为什么选择缺省值的时候,在录制的时候还要clickin on it for the value to be captured and correlated when the cities are parameterized?
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-6-13 16:07 , Processed in 0.071274 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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