【发布时间】: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