[英]vs2012 load test doesn't start up many threads
我已經建立了一個網絡測試。
在這里面我已經添加了書面文件。
我創建了5個僅運行上述webtest的虛擬用戶的負載測試。
在Graph view
我看到有5個Users load
。
最后,我只看到一行寫入文件。
我是否需要以某種特殊方式定義分布?
我認為設置虛擬用戶數就足夠了。 沒有?
順便說一句,什么會使我的負載測試在每次運行中准確運行10分鍾?
我不記得它限制到10分鍾
這是我的測試代碼:
公共類Settings_CacheExplosion:WebTest {//私有靜態只讀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;
}
}
檢查您的寫入方法沒有覆蓋現有條目。 如果文件中已經有文本,則需要使用append選項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.