Reputation: 787
In visual studio VSTS webtest, is there any option to set think time in milliseconds? i tried developing coded web test. what i can set in PreRequestEventArgs is
e.Request.ThinkTime = 1;
where ThinkTime is int type. So i am unable to set in milliseconds. So as a workaround i am using
public static PreRequestEventArgs ApplyGeneralRequestSettings(PreRequestEventArgs e)
{
// e.Request.ThinkTime = 1;
// Required 0.5
Thread.Sleep(500);
}
Are there any better options?
Upvotes: 0
Views: 838
Reputation: 14076
I believe that you cannot specify a think time smaller than one second.
Think times are specified in seconds, not in fractions of a second. This makes sense because think times are intended to model how people interact with a web site. The think time corresponds to the time a person takes to read the web page, to think about their response, to type in any data, and finally to click the "Next" button (or do whatever the do-the-next-thing action is).
Visual Studio can be set to randomly vary think times during a load test. I have not (yet) determined whether these variations result in an integer number of seconds or whether the result can yield fractions of a second.
It is tempting to use one of the many delay
or sleep
methods available. I advise against this because that stops a thread from running and a thread may be used for many virtual users. In experiments I have used System.Threading.Thread.Sleep(...)
and the thread will pause, but other virtual users also pause. In another experiment on a 4-core computer Visual Studio used 4 threads for the virtual users. Each thread ran many virtual users.
Upvotes: 1