Adding Loop and Branch Logic to Web Requests in Web Performance Tests
You can add flexibility to your Web performance tests by adding loops, branching conditions, and transactions.
Adding Loops to your Web performance tests: Add loop logic to Web performance tests to assign specific conditional rules and properties. This provides a simple way to have requests within a Web performance test run multiple times.
Adding conditional branching to your Web performance tests: Use conditional branching logic in your Web performance tests to assign specific conditional rules and properties. For example, you could create a condition on a Web request that compares a string on a Web page to a string value that you specify.
Consider the following potential issues when using loops in a Web performance test or a load tests using the Web performance test:
When you run the Web performance test on its own, that is, not in a load test, the entire Web test result is kept in memory. Therefore, a Web performance test that contains a loop with a lot of iterations can consume a lot of memory.
When you run this Web performance test in a load test, if the test takes a long time to run it will have an impact on the test mix in the load test. The load test engine will treat running the Web performance test as a single iteration. If, in fact, the Web performance test is running many iterations, you will not get the desired mix.
In general, an iteration through the Web performance test should be a model of what a single user will do on the site. It’s possible that some users might add several items to a shopping cart in a single session but that does not skew the model. However, looping should not be used to have a single user looping hundreds of times. Instead, let the load engine schedule that particular user hundreds of times. When possible, use less than 10 iterations in your loops.