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

浪子不回头ぞ 提交于 2019-12-12 06:24:25

问题


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

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; }

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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/17746081/how-can-i-pass-a-list-of-values-as-a-parameter-to-a-visual-studio-web-performanc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!