I have built a webtest.
In it I have added writing to file.
I have created loadtest with 5 virtual users that runs only the above webtest.
In the Graph view I see there were 5 Users load.
At the end I see only one line written to the file.
Do I need to define the distribution in some special way?
I thought setting the number of virtual users is enough. no?
btw, what can cause my loadtest to run exactly 10 minute on every run?
I don’t remember limiting it to 10 min
this is my test code:
public class Settings_CacheExplosion : WebTest
{
//private static readonly 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;
}
}
Check that your writing method isn’t overwriting the existing entries. You’ll need to use the append option if there is already text in the file.