|
在51testing 看到 LR的功能。
能以时间定义事务的成败。
例子代码 如下:
double time_elapsed, duration, waste;
merc_timer_handle_t timer;
Action()
{
lr_start_transaction("ACCP");
timer = lr_start_timer();
lr_think_time(3);
time_elapsed = lr_end_timer(timer);
// Convert to millisecond.s
waste = time_elapsed * 1000;
if(waste>3)
lr_end_transaction("ACCP", LR_FAIL);
else
lr_end_transaction("ACCP", LR_PASS);
return 0;
}
然后我自己录制的代码 中 自己定义了一个事务,然后想控制事务在1秒中内通过,然后才能判断事务成功。
但是 系统编译 抱错。
下面是我修改后的代码:
#include "web_api.h"
double time_elapsed, duration, waste;
merc_timer_handle_t timer;
Action()
{
lr_start_transaction("lymlogin");
timer= lr_start_timer();
time_elapsed= lr_end_timer(timer);
web_url("EMan",
"URL=http://192.168.1.180:8099/EMan",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_url("index.jsp",
"URL=http://192.168.1.180:8099/EMan/index.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
EXTRARES,
"Url=image/bg.gif", ENDITEM,
"Url=image/button_sure_fb.gif", ENDITEM,
LAST);
web_submit_form("systemController",
"Snapshot=t3.inf",
ITEMDATA,
"Name=loginID", "Value=lym", ENDITEM,
"Name=loginPassword", "Value=sasdjk", ENDITEM,
EXTRARES,
"Url=image/main_h_1024.jpg", "Referer=http://192.168.1.180:8099/EMan/systemController?id=2", ENDITEM,
"Url=image/bg.gif", "Referer=http://192.168.1.180:8099/EMan/systemController?id=2", ENDITEM,
"Url=image/right.gif", "Referer=http://192.168.1.180:8099/EMan/systemController?id=2", ENDITEM,
"Url=image/main_l_1024.gif", "Referer=http://192.168.1.180:8099/EMan/systemController?id=2", ENDITEM,
"Url=image/state.gif", "Referer=http://192.168.1.180:8099/EMan/share/state1.jsp", ENDITEM,
LAST);
web_submit_data("designController",
"Action=http://192.168.1.180:8099/EMan/designController?id=6745",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.1.180:8099/EMan/systemController?id=2",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
LAST);
waste =time_elapsed*1000;
if(waste>1)
lr_end_transaction("lymlogin", lr_fail_trans_with_error);
else
lr_end_transaction("lymlogin",lr_pass);
系统提示错误信息:
Action.c (59): type error in argument 2 to `lr_end_transaction'; found `pointer to int function(pointer to char,...)' expected `int'
Action.c (61): undeclared identifier `lr_pass'
d:\\lrfile\\querye\\\\combined_querye.c (4): 2 errors, not writing pre_cci.ci
不懂。。如何能写 lr_pass); |
|