HomeBUGS & ISSUES

Think you found a bug? Report it here.

How does the think time feature work? Messages in this topic - RSS

Huong Nguyen
Huong Nguyen
Posts: 69


5/11/2011
Huong Nguyen
Huong Nguyen
Posts: 69
***Resolved***
I don't see a place to change the think time value. I told the app to use recorded think time. When I created the test, it took 5 minutes. When I run the test case once, it finished in 1 minute. Can you explain if this is a bug or if I'm just not doing it correctly? Want the think time feature to simulate real user load instead of bombarding the server. This is needed for user acceptance of our load test results.
0 link
Vadim @StresStimulus
Vadim @StresStimulus
Administrator
Posts: 583


5/12/2011
Vadim @StresStimulus
Vadim @StresStimulus
Administrator
Posts: 583
Hi Huong,
 
Think time implementation in StresStimulus is in evolution. You are correct that there is no place to change think time value yet. We plan to add this option soon, possible in the next release.
 
We also noticed that some types of AJAX requests can cause incorrect reduction of long think times. Therefore, we will also work on eliminating inaccuracies that happen occasionally (which is the case in your situation).  So I don't think that you are doing anything wrong. Using think time is a great way to simulate real-world user load.
 
When it is released I will post in this thread, so you will receive auto-notification.
 
Cheers,
 
-Vadim
0 link
Huong Nguyen
Huong Nguyen
Posts: 69


5/13/2011
Huong Nguyen
Huong Nguyen
Posts: 69
Vadim,
Sounds great!
Meanwhile, for anyone who wants to use think time, I have the code that seems to work OK. I set StresStimulus' option to do not use think time so that there is no interference, and change the CustomCode.js to have this:
static var str_think_time = "Think_Time";
 static var last_request_session = null;
 public static BindUIColumn("BeginRequestTime", 60)
 function BeginRequestTime(oSession: Session)
 {
  var str_time = String.Empty;
  if (oSession.Timers != null)
  {  
   str_time = oSession.Timers.ClientBeginRequest.ToString();
   if (!oSession.oRequest.headers.Exists(str_think_time))
   {
    // When we load the files, if the headers doesn't have think time included,
    // calculate it based on the last request
    if (last_request_session == null) {oSession.oRequest.headers[str_think_time] = 0;}
    else if (oSession.id > last_request_session.id)
    {
     var time_difference = oSession.Timers.ClientBeginRequest.Subtract((System.DateTime)(last_request_session.Timers.ClientBeginRequest));
     oSession.oRequest.headers[str_think_time] = (System.Int32)(time_difference.TotalMilliseconds);
    }
    /*if (last_request_session != null)
    {
     MessageBox.Show("This ID: " + oSession.id + " (" + oSession.Timers.ClientBeginRequest.ToString() +  ") " +
      "Last ID: " + last_request_session.id + " (" + last_request_session.Timers.ClientBeginRequest.ToString() + ") " +
      "Think time: " + oSession.oRequest.headers[str_think_time]);
    }*/
    last_request_session = oSession;
   }
  }
  return str_time;
 }
 
 Make sure to try/catch this block following block of code
 Add this code to static function OnBeforeRequest(oSession: Session)
 var time_to_sleep = System.Int32.Parse(oSession.oRequest.headers[str_think_time]);
 // DEBUG: MessageBox.Show(time_to_sleep/1000)
 System.Threading.Thread.Sleep(time_to_sleep);
 oSession.Timers.ClientBeginRequest = System.DateTime.Now;
0 link
Vadim @StresStimulus
Vadim @StresStimulus
Administrator
Posts: 583


5/14/2011
Vadim @StresStimulus
Vadim @StresStimulus
Administrator
Posts: 583
Beautiful!  I would call it the first fiddler add-on, for a fiddler add-on. How does that sound? smile
0 link
Huong Nguyen
Huong Nguyen
Posts: 69


5/14/2011
Huong Nguyen
Huong Nguyen
Posts: 69
smile
0 link
Vadim @StresStimulus
Vadim @StresStimulus
Administrator
Posts: 583


5/19/2011
Vadim @StresStimulus
Vadim @StresStimulus
Administrator
Posts: 583
Hi Huong,
An option to modify Think time was added in the second May-11 Pro release.   The user can view and change recorded think times In Test Case area -> Page Settings. 
 
Huong, said: I don't see a place to change the think time value. I told the app to use recorded think time. When I created the test, it took 5 minutes. When I run the test case once, it finished in 1 minute.

 
Accuracy of replaying recorded think time was improved as well. Specifically, replaying long think time on AJAX pages should be more precise. If you have a chance please retest the 5-minute case and let me know if it works better now.
Note: For better accuracy, it is recommended to pause for at least 5 seconds between mouse clicks when recording test case.
 
Thanks,
 
-Vadim
0 link






Copyright © 2017 Stimulus Technology