Loop and virtual users
Verification points can fail during a run if virtual users in loops lose their original state. To enable each virtual user to enter the loop in the original state, you can...
- Modify the test's HTTP options
- Add custom code
By default, the cookie cache for a virtual user is not reset during a test run. This is consistent with a browser's behavior. If a test or schedule contains loops, and a web server sets a cookie during the first iteration of the loop, that cookie is "remembered" on subsequent iterations.
However, in certain instances, you might want to clear all cookies cached for a particular virtual user. For example, if you want each iteration of a loop to appear as a new user, you must reset the cache. If you do not, although the test completes, verification points that you have set within the test may fail.
There are two ways to reset the cookie cache...
- Reset the cookie cache when looping in the schedule, or when the test follows another test in the schedule, open the test, and on the HTTP options page, select...
Clear cookie cache when the test starts
![]()
Use this method if you are running back-to-back tests or Siebel tests.
- Reset the cookie cache from one loop iteration to the next when you have put a loop around the entire contents of the test, and the loop is inside the test, add custom code to the test and call an API, as follows:
- Run the test or schedule to add the current Java libraries to the class path.
- Open the test and select the test element located at the point where you want the cookie cache to be reset. Typically, this is at the end of the loop.
- Click Add or Insert and select Custom Code.
Add appends the custom code to the bottom of the selected element (test or test page). Insert adds the custom code above the selected page or page request.
- Add the following Java import statement:
Import com.ibm.rational.test.lt.execution.http.util.CookieCacheUtil;
- Add the following Java code inside the exec method:
clearCookieCache
The lines you add to the generated custom code template are bolded.
package test; import com.ibm.rational.test.lt.execution.http.util.CookieCacheUtil; import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices; public class Class1131739398417 implements com.ibm.rational.test.lt.kernel.custom.ICustomCode2 { public Class1131739398417() { } public String exec(ITestExecutionServices tes, String[] args) { CookieCacheUtil.clearCookieCache(tes); return null; } }See also: Clear cookies for a virtual user.
Related:
Redirection support for HTTP tests
HTTP test editor overview
Cut and paste in tests
Specify the number of allowable URL redirects during test runs
Define performance requirements in tests
Add an authentication folder
Verify expected behavior
Specify error-handling behavior
Split a test
Split a test page
Merge test pages
Disable and enable secondary HTTP requests
Reuse tests on different hosts: Server connection variables
Convert tests to use SSL connections
View a test in the Protocol Data view
Test Siebel applications
Run tests at a set rate
Repeat tests in a schedule
Add a loop to a test
Error 404 - Not Found Error 404 - Not Found
The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.