输出函数:
51Testing软件测试网P'{+OB,X[-Q
1、int lr_output_message (const char * format, exp1, exp2,...expn.); 将带有脚本部分和行号的消息发送到输出窗口和日志文件
51Testing软件测试网1cZLqh0c
参数:
#o5z'`$fVA0
format 格式字符串,使用标准的消息格式。
51Testing软件测试网/H/x qtWSx
exp1,exp2.. 参数列表
51Testing软件测试网T1h&V8u1Y
}f
51Testing软件测试网X"i#g]&Q:\
消息格式:
51Testing软件测试网+a1gAiA
Character51Testing软件测试网8dc"u] Ot]W4I
| Argument Type51Testing软件测试网2dE9E.mi
| Printed As ]Y8AO&^(h!i,T0
|
51Testing软件测试网$_%z\
t~O L(g
d,i51Testing软件测试网
i1c g*r-q)z
_
| int51Testing软件测试网u8yi
_sH\9B
| decimal number51Testing软件测试网4L"EBK1d Xs$V
|
A
gv3Bo(I(xbC-j0
o 5H3IB'qRq$](o0
| int e5V#EFn M0
| unsigned octal number without a leading zero51Testing软件测试网{pNJ'g2Hc
|
51Testing软件测试网a:n-f*p&ZP4U
x,X51Testing软件测试网!H+^]*N"KX r`z
| int51Testing软件测试网o@\?4N0{
| unsigned hexadecimal number without a leading 0x P&GxK8A-CNh0
|
51Testing软件测试网tPig!}
u 'YAE)j(S0
| int ]x;jSxu/I0
| unsigned decimal number uA0@1h,Vl:u0
|
Pg{;T
IL%I2r0
c E3^(OM0f%`,g0
| int U!v g W8ycK0
| single character C3uM7E"w0
|
y)[5T|+T'P6T5d.PE y9h5R0
s51Testing软件测试网/K
\qO&tR
| char * 2a2X8~l!TV0
| print characters until either `\0' or the number of characters given in the precision is reached51Testing软件测试网$vM G{+lTK{
|
1k"zLh(~ T0
e,E .|7`H8@&D0
| double51Testing软件测试网7m"Eq6D'`%I!e!e2zC
| engineering notation (m.dddddd e+exponent). If precision is greater than fractional part, prints trailing zeros zW*e8x{ {
B+TQZe0
|
51Testing软件测试网4ciSkm"J)UP
g,G f3jZ;|/bq!w0
| double51Testing软件测试网;U/L)I+u [W%Px
| engineering notation without trailing zeros or trailing decimal point51Testing软件测试网^{*T9q)m F
|
51Testing软件测试网6K3Ec-@wr]c
%51Testing软件测试网:|2e,^%]][wj1T
| none51Testing软件测试网2m+s&~7i
}
| print the character `%' -}*A5}zP0
|
51Testing软件测试网(o(TAx[
_F
示例:
pSp*dW K0
,v`UR4o0
lr_output_message ( "We are on iteration #%s", lr_eval_string ( "{iteration}" ) );//输出变量
51Testing软件测试网 d#l$q6K2d\Iv
2、int lr_message (const char * format, exp1, exp2,...expn.);将消息发送到日志文件和输出窗口
JF9GwE5GL0
参数同上。
51Testing软件测试网X.Oac
r
lr_message ("login failed: %s", abort);
VV)pxBR v8Lg0
与lr_out_message输出格式不同:
statement | Output |
PG._!y-SA6?;E _[w0
lr_message("a message")51Testing软件测试网h`}j9U1rF3C'P
| a message51Testing软件测试网9p%qy$Qj1q
|
0kB9O'i YUA0
lr_output_message("a message"); +j9Y W+X PQ0
| Action(4): a message51Testing软件测试网7]fgJ*g.G4^_8mk L
|
tz!lIw2R
l051Testing软件测试网UmnQajm2b
3、int lr_debug_message (unsigned int message_level, const char * format, ... );
51Testing软件测试网]6c
I;[4[7Zc
51Testing软件测试网t5J1R
o`p"iV%G#y
在指定的消息级别出于活动状态时发送一条调试信息。如果指定的消息级别未处于活动状态,则不发出信息。可使用lr_set_debug_message()设置消息级别,或使用lr_get_debug_message获取消息级别。
yR1b:z6~0
示例:
:FsmYU0y"w)p0
lr_debug_message(LR_MSG_CLASS_RESULT_DATA|LR_MSG_CLASS_PARAMETERS, "Operation"Operation failed.");
51Testing软件测试网%U
mK{%O9QA
\B,l)A1{S3~!Cw0
4、int lr_error_message (const char * format, exp1, exp2,...expn. );将错误消息发送到输出窗口和Vuser日志文件。
51Testing软件测试网0E;D.B1PZg5T
5、int lr_log_message (const char * format, exp1, exp2,...expn.);将消息发送到VUser或代理日志文件而不是发送到输出窗口。通过向日志文件发送错误消息或其它消息可以用于调试。
c4sj:S7S/o0
示例:
51Testing软件测试网:u"f)yn+D[*Q,E
char* abort="aborting...";
y@,f,iG9m)N0
...
51Testing软件测试网.K5q"?h^cJf
if (init() < 0) {
$pG%o1?%L9jG_0
lr_log_message ("login failed: %s", abort);}
51Testing软件测试网"j;ysO
C(WkV;Tn-t
return(0);
[g @|U{8mN(|'\0
}
51Testing软件测试网"M/Z:L,zp^z;k
51Testing软件测试网 bYW}-u!?
7a+xN2IOAG+wr0
6、int lr_set_debug_message (unsigned int message_level, unsigned int on_off); 设置脚本调试消息级别,通过设置调试消息级别,可以决定哪些消息发送。
51Testing软件测试网P&A6D(h5zm/M)IL
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON)//启用LR_MSG_CLASS_EXTENDED_LOG级别
2DmO`)?x@g0
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG,LR_SWITCH_OFF)//停用LR_MSG_CLASS_EXTENDED_LOG级别
51Testing软件测试网@,Oi7E`_$n]
x'J)n
三种消息级别
R_MSG_CLASS_DISABLE_LOG 0
51Testing软件测试网pc6d3M"u'ZRu,v
LR_MSG_CLASS_BRIEF_LOG 1
51Testing软件测试网m,o`~L-TE-@
LR_MSG_CLASS_EXTENDED_LOG 16
51Testing软件测试网.NT9so3k{x aM
51Testing软件测试网e"~O$?E_
7、unsigned int lr_get_debug_message ( );返回当前日志级别