UltraWPM scripts support simulating “user think time” by allowing you to control the speed in which browser interactions occur, as well as script in manual pauses. Depending on the application you are testing and the goals of your test, “user think time” may be an important part of your script. But sometimes your tests need to be more realistic. For example, you might wish to measure the true capacity of the site, taking in to consideration all the server-side sessions and the impact they have on CPU and memory even when active HTTP requests are not being made from the browser. Or your web app might involve advanced AJAX techniques that actually cause additional HTTP activity even when the user is sitting idle (ie: a live chat website).
The pause() command can be used by both RBU and VU scripts and does exactly what you would imagine it would do: it causes the script to pause for the specified amount of time (in milliseconds). So if, for example, we wanted to pause for exactly 15 seconds after logging in in the previous script, we would have:
var driver = openBrowser();
beginTransaction();
beginStep("Step 1");
driver.get("http://example.com/login");
driver.findElement(By.id("username")).sendKeys("joe");
driver.findElement(By.id("password")).sendKeys("password");
driver.findElement(By.id("loginBtn")).click();
waitForNetworkTrafficToStop(1000, 15000);
endStep();
// pause for 15 seconds
pause(15000);
beginStep("Step 2");
driver.findElement(By.linkText("Foo")).click();
waitForNetworkTrafficToStop(1000, 15000);
endStep();
beginStep("Step 3");
driver.findElement(By.linkText("Bar")).click();
waitForNetworkTrafficToStop(1000, 15000);
endStep();
endTransaction();
It is also important to note that the time spent paused is broken out from the normal timing of the transaction and the step. This allows you to still focus on the raw performance of the user-initiated requests (ie: clicking a link, typing text, etc) while still keeping track of the pause time. Please consult the Useful SQL Queries for Load Test for more information on the time_active and time_paused columns.