需要插件或代码来启用VSTS .webtest中的自定义提取规则 [英] Need Plugin or code for enabling custom extraction rule in VSTS .webtest

查看:52
本文介绍了需要插件或代码来启用VSTS .webtest中的自定义提取规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我的.webtest脚本面临巨大的关联要求.因此,为了进一步开发.webtest脚本,我需要定义一些自定义提取规则,并使用少数几个左边界右边界.

I am facing huge correlation requirement for our .webtest script. Hence for further .webtest script development I need to define some custom extraction rules with few sets of Left boundary and Right Boundary.

我从论坛获得了以下URL参考,这些URL用于用于基于输入字段名称定义自定义提取规则的插件

I got below url references from forum for plugin used to define custom extraction rule based on input field name

" https://msdn.microsoft.com/en-us/library/ms243179(v = vs.100).aspx 

"https://msdn.microsoft.com/en-us/library/ms243179(v=vs.100).aspx" 

但是我们的提取复杂度很高,因此我们无法使用此插件,因为我们需要从响应中提取许多其他值.

But our extraction complexity is high such that we cannot use this plugin as we many other values that needs to be extracted from the response.

在这里感谢您的帮助.

请共享完整的插件代码,以便在工具中添加自定义的关联规则.

谢谢

Swaraj Gujja

Swaraj Gujja

推荐答案

通常,提取规则将提取一个值.因此,要从响应中提取多个值,您将使用多个提取规则.作为替代,您可以编写一个"PostRequest"消息.用于"WebTestRequestplugin"的方法.在这样的插件中 您可以编写代码以提取多个值并将其保存到多个上下文参数中.插件的基本部分可以包含几组形式为'string CP1Value = ...; e.WebTest.Context ["CP1"] = CP1Value;'.当然 您应该为变量和上下文参数使用更好的名称.

Typically, extraction rules extract ONE value. So to extract multiple values from a response you would use multiple extraction rules. As an alternative, you can write a "PostRequest" method for a "WebTestRequestplugin". In such a plugin you can write code to extract multiple values and save them into a number of context parameters. The essential part of the plugin could have several set of statements of the form 'string CP1Value = ...; e.WebTest.Context["CP1"] = CP1Value;'. Of course you would use better names for the variables and context parameters.

有关编写插件和提取规则的更多信息,请参见: https://msdn.microsoft.com/zh-CN/library/bb514192(v=vs.110).aspx  和

For more on writing plugins and extraction rules see: https://msdn.microsoft.com/en-us/library/bb514192(v=vs.110).aspx and https://msdn.microsoft.com/en-us/library/ms243179(v=vs.120).aspx

致谢

艾德里安


这篇关于需要插件或代码来启用VSTS .webtest中的自定义提取规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆