51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2090|回复: 0
打印 上一主题 下一主题

A useful addition to your LoadRunner function library

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2005-11-8 13:39:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Okay, this is a bit of a tease because I haven’t actually written this function, but it would be nice if someone out there would (maybe it will be me when I get some more free time).

web_reg_save_param() is a useful little function for easily extracting text from the last HTTP response received by the virtual user. You specify left and right boundaries, the occurrence of the text you want to find and a large number of other options which, admittedly, don’t give you the power of regular expressions but are a lot easier to use.

The only problem is that once you’ve got a piece of text from the web page (or some other source), you can’t use this function to help with further manipulations of the text. The closest equivalent function is lr_save_searched_string(), which is useful, but only allows you to specify a left boundary and the number of characters to save. To get the equivalent of web_reg_save_param() requires writing string manipulation code using the standard C libraries which, we all know, some people find a little difficult.

It would be nice to have a function that was the equivalent of web_reg_save_param(), but that you could pass an arbitrary string to. Various people have written functions that implement a small sub-set of the required functionality (like returning text between boundaries), but I have never seen anything which is even close being feature-complete; besides, code in Mercury’s User Contributed Knowledge Base is notoriously buggy.

A good implementation of this function - let’s call it lr_reg_save_param() - might have the following attributes…

Would accept the same arguments as web_reg_save_param(), except with an additional argument for the input string.
int lr_reg_save_param (char* InputString, const char *ParamName, <list of Attributes>, LAST);
Would work in exactly the same way as web_reg_save_param() - I don’t want to have to learn how to use another function.
Would be threadsafe - users shouldn’t have to chase down this type of bug.
Would not create any LoadRunner parameters except for the parameter name specified - this prevents any problems when users inadvertently have a parameter name that is the same as one that is used internally by the function.
Would be well-tested and bug-free.

原文出处:http://www.myloadtest.com/a-usef ... r-function-library/
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-23 07:42 , Processed in 0.089913 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表