web_get_int_property(HTTP_INFO_RETURN_CODE)详解

上一篇 / 下一篇  2011-12-16 17:05:30 / 个人分类:LoadRunner

51Testing软件测试网1z)L#U E&[6h

近期做一个网站的性能测试,意图想检查每个请求都正常返回。用了web_get_int_property(HTTP_INFO_RETURN_CODE)方法51Testing软件测试网 cQv+U4I3k |

51Testing软件测试网#u#?bUjW1S$m7jG

发现了一些奇怪的现象:51Testing软件测试网tETo+Ce5yq

51Testing软件测试网9EC!l%q^d.H m4GG

 lr_start_transaction("高考政策");

5Y7y{f3N'nYc;| _051Testing软件测试网k7k0T YY C2jH ~:qH'E

web_url("ZhengCe",51Testing软件测试网 }+K#V'Nj Ej0S h9]t
  "URL=http://content.21edu.com/GaoKao/XinWen/ZhengCe",51Testing软件测试网RSJ1Ka0N8ju^
  "TargetFrame=",
2RS$^$ZPE)@.@0  "Resource=0",51Testing软件测试网%wd3],FJ!E3V P;z
  "RecContentType=text/html",
q%bsPD@-SI0  "Referer=http://content.21edu.com/",51Testing软件测试网;kj$\9@q$T
  "Snapshot=t2.inf",51Testing软件测试网V*?.q)\Owa
  "Mode=HTML",
d#uNe2\Z f.c tb0  EXTRARES,51Testing软件测试网%E;A`YQ;u2L
  "Url=/Template/21Edu/BinaryResource/Theme/21edu.theme/Images/bg_list_left.gif", ENDITEM,
%NI*l/YQ$O0l0  "Url=/Template/21Edu/BinaryResource/Theme/21edu.theme/images/icon.gif", ENDITEM,
0O.d g1O@p-Qc#\l~0  LAST);

l7DG]R?.b4E0

+P!QL"Np\ S0    HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);51Testing软件测试网8P O ?2Aw_Os-Pv
    if(HttpRetCode==200){51Testing软件测试网n3}k2OVF%\:vF
        lr_end_transaction("高考政策", LR_PASS);
{R*R~(nw3?(p0    }
*a8T)w$M9L\;]8o0    else
I3]/slu{0    {
7O3Ds/y9eC0        lr_end_transaction("高考政策", LR_FAIL);

9P8~;k2e#s!n/R'N9u M0

0}(^j&l4d$?~e0    }51Testing软件测试网`E5{~gz;Fb!k2P.a"oX

51Testing软件测试网 K UjwX`

 /*高考动态*/51Testing软件测试网b _f7sd?cY"H

t0I)?~uj9dD0 lr_think_time(5);
^x A'e(vyg8@0 lr_start_transaction("高考动态");
p%CI.O,b0 web_url("DongTai",
5qh?&s _YZ0  "URL=http://content.21edu.com/GaoKao/XinWen/DongTai",
:ts"w!F9s f*ep?0  "TargetFrame=",
_Q.Cw/[$| o G0  "Resource=0",
S.ck| ^ dTCP0  "RecContentType=text/html",51Testing软件测试网*iq2`No%_ML
  "Referer=http://content.21edu.com/GaoKao/XinWen/ZhengCe",51Testing软件测试网 \8VxCC
  "Snapshot=t3.inf",51Testing软件测试网w)Vk1m;y5U&r7_]9b(\
  "Mode=HTML",51Testing软件测试网x#e\5Xm+J*S.tTZ
  LAST);
M0h ff)u#I0    HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);51Testing软件测试网.TG5Y_1`"^
    if(HttpRetCode==200){51Testing软件测试网Y*TIu.B.P
        lr_end_transaction("高考动态", LR_PASS);51Testing软件测试网IsE/y~E
    }
'W#pcj@2]0    else
J,a:? Jw}8W Rr'Uz0    {
9?/Y7g#[1Qk S*P0        lr_end_transaction("高考动态", LR_FAIL);

Dz\!f3]"qGt'Cc0

^0a1I)N&~@J,h0    }51Testing软件测试网*z(Li(t)I*v0t

51Testing软件测试网&y m]z$U?e{

允许结果:

MG Z"@6GOH y;zO4u051Testing软件测试网0B`~?~4J5g]

Action.c(62): Notify: Transaction "高考政策" started.51Testing软件测试网y0b$gIa5|
Action.c(64): Resource "
http://passport.xueda.com/Scripts/passport.logon.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
T]"B-M&h@3p0Action.c(64): Resource "
http://images.21edu.com/passport/passport.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网Q b _#N^1W
Action.c(64): Found resource "
http://content.21edu.com/Template/21Edu/LayoutTemplate/head.css" in HTML "http://content.21edu.com/GaoKao/XinWen/ZhengCe"   [MsgId: MMSG-26659]51Testing软件测试网;G6hmV0O uxR&O
Action.c(64): Resource "
http://www.21edu.com/scripts/400_phone.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
@+ejA/\b$]{6v b0Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/head.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网^c2N*D`I/rP
Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/index.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
;W J$h JJ0C+Q-~ ~ \0Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/menu.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网$z\$OJ W]FV
Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/pagination.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
.Q#s4t-s?`0Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/picturn.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
:_-pf1@$`3u[ E0Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/tanchu.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
%u DWu QP[[j0Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/aaaaaaaaajquery.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
G;Hc\?P0Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/autoscroll_pack.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
`g%N6o0z bE0Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/cityschool.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网 F4N | euxcK
Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/easySlider.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网:TFS'r%eEF
Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/jquery.pagination.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网[eL D|/@;zk
Action.c(64): Downloading resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/Images/bg_list_left.gif" (specified by argument number 10)   [MsgId: MMSG-26577]
x&z$oS"R'R0Action.c(64): Downloading resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/images/icon.gif" (specified by argument number 12)   [MsgId: MMSG-26577]51Testing软件测试网k)C+xf5u;C6_ Wf
Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/scroller.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网2?Z7OlC+b
Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/study.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网/pG?(_(UjLu
Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/tabClick.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网 O5K#o+wf^j
Action.c(64): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/texiao.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网(p-X;F4G:|5n9g
Action.c(64): Resource "
http://images.21edu.com/www/images/logo.gif" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
x~T$a m,YX {r0Action.c(64): Resource "
http://images.21edu.com/www/images/icon_jt_downhead.gif" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
Db}e/D D K0Action.c(64): Resource "
http://images.21edu.com/www/js/location_mono.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网S6|4z~G
Action.c(64): Resource "
http://images.21edu.com/content/images/bj/ad/gaosan.jpg" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网'JA3W lM@:\Bs
Action.c(64): Resource "
http://stat.xueda.com/phpstat/count/abceffgh/abceffgh.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网,j;X)|`A ]f
Action.c(64): Warning -26627:HTTP Status-Code=404 (Not Found) for "
http://content.21edu.com/Template/21Edu/LayoutTemplate/head.css"   [MsgId: MWAR-26627]51Testing软件测试网3M~&wo$CR5b3n%u;D4a
Action.c(64): web_url("ZhengCe") highest severity level was "warning", 58846 body bytes, 1128 header bytes   [MsgId: MMSG-26388]51Testing软件测试网fC!Z*B$}B&}DL
Action.c(77): web_get_int_property was successful   [MsgId: MMSG-26392]51Testing软件测试网| k HB j4Md&e#Nm
Action.c(79): Notify: Transaction"高考政策" ended with "Pass" status(Duration: 0.8926 Wasted Time: 0.0107).51Testing软件测试网J@K6Hk%z7[ q:}
Action.c(90): Notify: Transaction "高考动态" started.
i t7^]2`,z!ya0Action.c(91): Resource "
http://passport.xueda.com/Scripts/passport.logon.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
hT3q-J/?O5?0Action.c(91): Resource "
http://images.21edu.com/passport/passport.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网E4[rj`3nqy
Action.c(91): Found resource "
http://content.21edu.com/Template/21Edu/LayoutTemplate/head.css" in HTML "http://content.21edu.com/GaoKao/XinWen/DongTai"   [MsgId: MMSG-26659]
$IRi&v.S | wVA0Action.c(91): Resource "
http://www.21edu.com/scripts/400_phone.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网%G:U([bG;bV4L:^
Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/head.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网] q*Tj @*@0BoK
Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/index.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
Fk_:j]NHU r0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/menu.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
D+?7tUD5[6}0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/pagination.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
ct2Q5?4^0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/picturn.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
6q%j_2J#GOO4M0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Theme/21edu.theme/css/tanchu.css" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
4@%Q7[8X0~%C0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/aaaaaaaaajquery.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
/LM/OOAg D@0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/autoscroll_pack.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网}(Cn9g#o/D h R,Y+?1T
Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/cityschool.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网^G a.AJdG/vB
Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/easySlider.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
[ G4}sUC%Q9z\1O\0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/jquery.pagination.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网cNu*|6Wq
Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/scroller.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网7xi]:r,v2D A8t
Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/study.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
'p l1K tb2d D7VY0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/tabClick.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
?h,Rrr{3z2X0Action.c(91): Resource "
http://content.21edu.com/Template/21Edu/BinaryResource/Javascript/texiao.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网E#^VOPY'ES-_-b8a
Action.c(91): Resource "
http://images.21edu.com/www/images/logo.gif" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
@2V!~p C+Ag0Action.c(91): Resource "
http://images.21edu.com/www/images/icon_jt_downhead.gif" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]
'U'p3H'U{ zo0Action.c(91): Resource "
http://images.21edu.com/www/js/location_mono.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网#EJ wQ^.lp `kA5q
Action.c(91): Resource "
http://images.21edu.com/content/images/bj/ad/gaosan.jpg" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网0?-| iqX
Action.c(91): Resource "
http://stat.xueda.com/phpstat/count/abceffgh/abceffgh.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网h-~p9?/k8_Z
Action.c(91): Warning -26627:HTTP Status-Code=404 (Not Found) for "
http://content.21edu.com/Template/21Edu/LayoutTemplate/head.css"   [MsgId: MWAR-26627]
Lw QrA1t+v7X tQ0Action.c(91): web_url("DongTai") highest severity level was "warning", 26860 body bytes, 520 header bytes   [MsgId: MMSG-26388]51Testing软件测试网 zBlJo,}T"Y9}e
Action.c(100): web_get_int_property was successful   [MsgId: MMSG-26392]
Z/{_eiiQ0Action.c(106): Notify: Transaction"高考动态" ended with "Fail" status(Duration: 1.0974 Wasted Time: 0.0044).

8iL%mQa0iRR,Z051Testing软件测试网*k8C;P Dfn

两个web_url请求中服务器返回结果中都有HTTP Status-Code=404但是从事务结果看 前面一个是成功,后面一个是失败的。(纳闷吧)51Testing软件测试网){Da3O;a W`"@

X4p)]sEU5fIR0接下来吧 上面代码第一个web_url修改下51Testing软件测试网\tp6o2D:el ye

S;p"s,^-v!k(bQ0 lr_start_transaction("高考政策");

!EKU YD7D ud051Testing软件测试网 Ij^,x4?)Xi(e&]&D Do

web_url("ZhengCe",51Testing软件测试网6SMr.O\~3gt
  "URL=http://content.21edu.com/GaoKao/XinWen/ZhengCe",51Testing软件测试网F2R%|r2Z|X"_
  "TargetFrame=",51Testing软件测试网(q0ctbX$_+EzX N
  "Resource=0",
'P.|;O!Hv._G&y&m0  "RecContentType=text/html",51Testing软件测试网Nj%nV9PPG4`Cg
  "Referer=http://content.21edu.com/",51Testing软件测试网 F}&QY}|U+k
  "Snapshot=t2.inf",
f)f*DfO0  "Mode=HTML", 51Testing软件测试网_0f.~{+H"m;O#V&c!xQ
   LAST);
51Testing软件测试网Q m;{l]:Qne

51Testing软件测试网 w Al7I$s#q m

//把请求附属资源去掉

#e.rR0Q^m0

o?-?3w*PK4B0 //EXTRARES,
l:C5gZ.ac/T];q0  //"Url=/Template/21Edu/BinaryResource/Theme/21edu.theme/Images/bg_list_left.gif", ENDITEM,51Testing软件测试网'?QT3Gw2Y1yC
  //"Url=/Template/21Edu/BinaryResource/Theme/21edu.theme/images/icon.gif", ENDITEM,

b%Xl u K051Testing软件测试网+r1_$D8D G

    HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
CKmO$O'SF0    if(HttpRetCode==200){
\y.i"qq0        lr_end_transaction("高考政策", LR_PASS);51Testing软件测试网J!yI$\ZYP1P*x
    }
]KrzgK"L,zDeV0    else
`)U$y o}9ON m0    {
;sj j4]5F@0        lr_end_transaction("高考政策", LR_FAIL);

tEz kH9V*k:^)N q051Testing软件测试网&[9x$f6q @#^ i#Qi vr/?

    }

L8T Y ?6N1{ e\051Testing软件测试网 z u+|4icP3w(PT(H)`C

看运行结果:51Testing软件测试网-z+BB0a0Fcf z?4c9v

qB}s XTd:V{&h6Ki0Action.c(64): Resource "http://stat.xueda.com/phpstat/count/abceffgh/abceffgh.js" is in the cache already and will not be downloaded again   [MsgId: MMSG-26655]51Testing软件测试网XueE(G/y|E
Action.c(64): Warning -26627:HTTP Status-Code=404 (Not Found)for "
http://content.21edu.com/Template/21Edu/LayoutTemplate/head.css"   [MsgId: MWAR-26627]51Testing软件测试网1r7S3j_B
Action.c(64): web_url("ZhengCe") highest severity level was "warning", 26896 body bytes, 520 header bytes   [MsgId: MMSG-26388]51Testing软件测试网)^ EG#i af8Xp
Action.c(73): web_get_int_property was successful   [MsgId: MMSG-26392]
m)`s"a q?j0Action.c(83): Notify: Transaction "高考政策" ended with "Fail" status(Duration: 0.9543 Wasted Time: 0.0040).
51Testing软件测试网4l,wOoU&d;cr5o

51Testing软件测试网6z0a!GmL"D:} Sm

这次跟第二个事务一样 事务失败。

X+ZZF"cMW0

:bW h;a%W{6`m0这个方法 如果事务里头包含多个请求,建议不要用,因为他返回的值 是最后一个接收到响应头里的状态码。

u h5c0a!xIZ:e _'H G051Testing软件测试网ib6cWI X:a"o

HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE)

i e'[A y4S!Bz051Testing软件测试网zw;sR:tol K5S

Note:51Testing软件测试网o CG(Qp$XrI;d
The web_get_int_property function only captures the last status code that was received. If there is a redirection in between, it is not reflected. To get all of the responses, you can use the web_reg_save_param function with:
51Testing软件测试网'pNs0Y]


TAG:

 

评分:0

我来说两句

Open Toolbar