ThinkTime by definition is the time spent by a User thinking about his next step. This has been leveraged in VSTT CodedUITest and Fast-Forward a Test feature in MTLM (as also in VSTT Web Test) to make the Playback more resilient.
If the ThinkTime is turned ON then the delay between each actions is identified and stored in the XML (for MTLM ) incase the delay is greater than a User Specified Interval (ThinkTime Threshold). In CodedUITest an function Call with the ThinkTime Interval is added.
// Wait for 14 seconds for user delay between actions; Click ‘Start’ button
During Playback RnP will wait for the ThinkTime Interval for the action before doing the Playback for that action. This will ensure that if waiting for that particular instance sparks off a particular change in the Application (Or the Environment like a Pop-up Coming up) then the playback will happen on the changed Settings.
User Can Specify a ThinkTime Multiplier as well. During Playback the User may decide that the interval needed to wait may be a multiple/fraction of the original WAIT Time and can alter that as per his convenience. This comes in handy if the Network/Hardware Configuration changes between Recording and Playback and may need differential delay during playback.
So Far alls well but what if during Recording User needed to take a break or his Manager dropped in for a quick chat :).. In such scenarios a ThinkTime of a large duration would have been recorded and would make the Playback Slower… However for such Scenarios User needs to modify the ThinkTimeUpperCutOFF to a high enough duration he will never think for and if the ThinkTime exceeds that duration it will be removed.
Usage Scenarios and Recommendation
ThinkTime is especially useful when a Client-Side Application is making a background thread Call (Web Service Call/DatabBase Service requests) and that results in the UI being updated. For such Scenarios the in-built Wait For Ready (WFR from now on) mechanism of RnP fails sometimes and the recommendation is to use ThinkTime in such scenarios. For Web Applications recommendation is to turn-Off ThinkTime as the built-IN WFR is good enough and ThinkTime adds extra delays making the Playback Slower.
- Turn ON ThinkTime for Client Applications (both Winforms and WPF).
- Turn OFF ThinkTime for Web Applications.
Configuring ThinkTime Settings
In MTLM user can set it in the following way :
LabManager -> TestSettings -> New/Open Test Settings -> DataAndDiagnostics -> Action Recording and Action Log.
User can enable recording think time by checking the option displayed in the first highlighted area and by setting a value. Default is 10 seconds.
The next highlighted part is for ThinkTimeMultiplier whose default value is set to 1.
ThinkTimeUpperCutOff property can only be configured using MTLM.exe.config after adding the following key
<!– Think time upper cut-off in milliseconds.
This represents the maximum think time value. –>
<add key=”ThinkTimeUpperCutoff” value=”120000″ />
Following are the properties provided to user to configure/change think time settings.
This Boolean key exists in CodedUITestBuilder.exe.config. The default value is false.
User can configure it through CodedUITestBuilder.exe.config. The default value is 10 seconds.
User can change the DefaultValue of 1 by
Playback.PlaybackSettings.ThinkTimeMultiplier = MULTIPLIERVALUE ;
It can be configured in CodedUITestBuilder.exe.config. Default value is set to 2 minutes.