关于是否需要删除Web_Add_Cookie

上一篇 / 下一篇  2012-03-22 09:44:42 / 个人分类:Loadrunner

最近录制一段LR脚本,回放成功,系统会增加一条数据。但是一段时间后再去跑,就会失效——没有抛错,只是实际没有增加一条数据。

判断为:web_add_cookie引起的问题。注释相关语句后,无论间隔多久,都能成功回放。


相关知识摘抄:

Q:Web_Add_Cookie, do i need to remove this from my script?

A:The answer is "sometimes". It depends on where that recorded cookie came from.The rule of thumb:
- If the cookie is added via a HTTP header, then you can probably remove it.(多数都是这种情况,且多数是可以删除的。)
- If it's added via javascript. (document.cookie = ) then you probably can't and may have to correlate.


The thing is, Loadrunner solves the cookie problem for roughly 90% of the
cookies by automatically handling cookies that get added via HTTP headers when
the script. runs. Don't ask me why it still records those. It does, and we get to delete them. But, for the remaining 10% or so (YMMV - it's probably less) of the cookies in your recording there actually is a good reason why they are there:
They were added via other means - usually javascript, code running inside the
 webpage which the basic HTTP protocol does NOT emulate. (That's what Click & Script. is for..) However, at times,the cookies may cause your scripts not to work as they are retrieving specified values from the cookies which are used in authentication.(这次遇到的应该就是这个问题。)

Er, cookies do not on their own retrieve values from other cookies. Sure, it's possible that a cookie gets added via javascript. that uses a value that was added via a different cookie. In that case you may have to correlate these values. But the criterium 'it uses a value inside a cookie' isn'twhy you correlate. The real criterium is "it uses data that was send to me in the previous transaction".How it was send to you and how you send that data back is kind of irrelevant.

总结:
Remove the cookie and run the scripts, if no issues, then u can remove it. Only some cookies need to correlated. These cookis will not make any impact on the system/response times.

TAG:

 

评分:0

我来说两句

Open Toolbar