【问题标题】:Web Performance Testing context paramtersWeb 性能测试上下文参数
【发布时间】:2013-12-24 04:25:16
【问题描述】:

我使用了 MSDN guide on creating Custom Extraction Rule,它展示了这个例子(Extract 方法):

    public override void Extract(object sender, ExtractionEventArgs e)
    {
        if (e.Response.HtmlDocument != null)
        {
            foreach (HtmlTag tag in e.Response.HtmlDocument.GetFilteredHtmlTags(new string[] { "input" }))
            {
                if (String.Equals(tag.GetAttributeValueAsString("name"), Name, StringComparison.InvariantCultureIgnoreCase))
                {
                    string formFieldValue = tag.GetAttributeValueAsString("value");
                    if (formFieldValue == null)
                    {
                        formFieldValue = String.Empty;
                    }

                    // add the extracted value to the web performance test context
                    e.WebTest.Context.Add("someNameHere", formFieldValue);
                    e.Success = true;
                    return;
                }
            }
        }
        // If the extraction fails, set the error text that the user sees
        e.Success = false;
        e.Message = String.Format(CultureInfo.CurrentCulture, "Not Found: {0}", Name);
    }

但是,我只是不知道如何在 Web 测试中使用访问 someNameHere 并将其作为参数添加到 QueryString 中。

任何帮助将不胜感激。

【问题讨论】:

    标签: asp.net web performance-testing


    【解决方案1】:

    在web测试中右键点击请求,选择“添加URL查询字符串参数”。根据需要更改名称并在值字段中输入{{someNameHere}}。双花括号要求插入上下文参数值。双花括号可用于将上下文参数的值插入 Web 测试中的许多其他位置。请注意,text{{someNameHere}}moretext 等字符串可用于将上下文值连接到其他字符串。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 2011-02-06
      • 2016-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多