如何将值列表作为参数传递给Visual Studio Web性能测试或负载测试插件? [英] How can I pass a list of values as a parameter to a Visual Studio web performance test or load test plugin?

查看:120
本文介绍了如何将值列表作为参数传递给Visual Studio Web性能测试或负载测试插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否要将值列表作为参数传递给Visual Studio Web性能测试或负载测试插件?

Want to pass a list of values as a parameter to a Visual Studio web performance test or load test plugin?

诸如http://msdn. microsoft.com/en-us/library/ms243191(v=vs.110).aspx 解释了如何创建插件的基础知识,我有几个简单的插件.但是关于如何指定插件的属性(即参数)的细节很少.从示例中,我发现了C#代码,例如

Pages such as http://msdn.microsoft.com/en-us/library/ms243191(v=vs.110).aspx explain the basics of how to create a plugin and I have several simple plugins. But there is very little details on how to specify the properties (ie parameters) for the plugin. From examples I have found C# code such as

public class MyPlugin : WebTestPlugin
{
    [System.ComponentModel.DisplayName("Simple string parameter")]
    [System.ComponentModel.Category("The category")]
    [System.ComponentModel.Description("Description of the simple string")]
    [System.ComponentModel.DefaultValue("The default value")]
    public string MySimpleString { get; set; }

类型可以是intbool以及string.但是我想要一个字符串数组(或列表或集合).

The type could be int or bool as well as string. But I would like an array (or list or collection) of strings.

当查看负载测试的 Test mix 属性时,它显示为(collection),并且在选中时出现省略号.单击省略号会打开一个用于测试列表的编辑器.类似的东西会很有用.

When the Test mix property of a load test is viewed, it is shown as (collection) and when selected an ellipsis appears. Clicking the ellipsis opens an editor for the list of tests. Something similar would be useful.

推荐答案

可悲的是,插件属性值实际上仅限于bool,字符串和数字类型.此限制在Microsoft.VisualStudio.QualityTools.WebTestFramework程序集中硬编码.无法支持其他类型(很好,一个例外)或获得任何增强的编辑器功能(例如在Test中)混合收集示例.

Sadly, plugin property values are indeed limited to bool, string and numeric types. This restriction is hard-coded within the Microsoft.VisualStudio.QualityTools.WebTestFramework assembly. There is no way to support other types (well, with one exception) or get any enhanced editor features such as in your Test Mix collection example.

例如,如果要让某个属性接受字符串列表,则唯一的选择是拥有字符串类型的属性,并通过在定界符上进行拆分将字符串解析为一个列表.令人失望,但事实如此.

If you want a property to accept a list of strings, for example, the only option is to have a property of type string, and parse the string into a list by splitting on a delimiter. Disappointing, but true.

这篇关于如何将值列表作为参数传递给Visual Studio Web性能测试或负载测试插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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