|
题目是这样的:
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()是不是更好点? |
|