Randomized Think Time Solution

Document created by HartfordFireInsurance on Aug 14, 2015
Version 1Show Document
  • View in full screen mode

I just recently had a requirement to randomize the response (DevTest's Think Time), between 1 - 2 seconds, and wanted to share the solution.  Just change the (2) to whatever upper range is desired.

1. In the virtual service image (vsm), add a "Java Script Step" after "VS Image Response Selection".  For Java code use:

Random rn = new Random();

int answer = rn.nextInt(2) + 1;


The 1st hit generated a think time 1.273 seconds.  The 2nd 1.812, an so on ...