我已经构建了一个webtest。
在其中我添加了写作。
我创建了一个仅运行上述WebTest的虚拟用户的LoadTest。
在Graph view
中,我看到有5个Users load
。
最后,我只看到一行写在文件上。
我需要以某种特殊的方式定义分布吗?
我认为设置虚拟用户的数量就足够了。否?
顺便说一句,什么会导致我的负载测试在每次运行中精确运行10分钟?
我不记得将其限制为10分钟
这是我的测试代码:
公共类设置 { //私有静态读取iLog activityLog = logmanager.getLogger(" Activity");
private static int _ctidsCounter { get; set; }
public static int CtidsCounter
{
get
{
if (_ctidsCounter == 2000)
{
_ctidsCounter = 1000;
}
return _ctidsCounter++;
}
set
{
_ctidsCounter = value;
}
}
public Settings_CacheExplosion()
{
this.PreAuthenticate = true;
CtidsCounter = 1000;
//log4net.Config.XmlConfigurator.Configure();
}
public override IEnumerator<WebTestRequest> GetRequestEnumerator()
{
WebTestRequest request1 = new WebTestRequest("http://clientservice.mam.qasite-services.com/settings");
request1.Method = "POST";
Debug.WriteLine(string.Format("ctid={0}", CtidsCounter));
request1.QueryStringParameters.Add("ctid", CtidsCounter.ToString(), false, false);
StringHttpBody request1Body = new StringHttpBody();
request1Body.ContentType = "";
request1Body.InsertByteOrderMark = false;
request1Body.BodyString = "";
request1.Body = request1Body;
string path = @"Settings_CacheExplosion_log.txt";
// This text is added only once to the file.
if (!File.Exists(path))
{
// Create a file to write to.
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(string.Format("ctid={0}", CtidsCounter));
}
}
// This text is always added, making the file longer over time
// if it is not deleted.
using (StreamWriter sw = File.AppendText(path))
{
sw.WriteLine(string.Format("ctid={0}", CtidsCounter));
}
yield return request1;
request1 = null;
}
}
检查您的写作方法是否没有覆盖现有条目。如果文件中已经有文本,则需要使用附录选项。