Some test cases with loops may require extractors from the previous loop's iteration to be used in the next iteration. For example, a single page wizard test case where the number of steps varies, and every next step depends on the previous step. 

Let's go through an example of setting up such a test and explaining its playback.

Recording & configuring the test case

After recording a test case, the test case tree looks as follows.

  • There is a wizard transaction that contains all wizard-related requests.
  • There is a start wizard request (#3 /start-wizard)
  • There are multiple wizard step requests (#4-18 /wizard-step)
  • Each /wizard-step has a step_id field that specifies which step in the wizard to display. Each subsequent step_id field value is extracted from the previous response.

Setting up the test case.

Since the number of wizard steps varies, a Do...While loop should be created around the first /wizard-step request, and the rest should be deleted.

The last step is to correlate the step_id field. The first step_id value comes from /start-wizard (#3) response. The rest step_id values come from the/wizard-step (#4) response from the previous loop iteration.

  1. Create an extractor called stepId from /start-wizard (#3) response.
  2. Use this extractor to parameterize the step_id request field in /wizard-step (#4).
  3. Create an extractor called stepId2 from /start-wizard (#4) response.
  4. Set the Copy value to Extractor property to stepId.

Loop until an extractor is no longer found

When a virtual user evaluates an extractor from a response during a load test, the result value is persisted throughout the entire test until the extractor is re-evaluated.

By default, if an extractor is not found, then the previous value is retained. To change this behavior, set the Override previous value when not found property to Yes.

Consider an example where a Do...While container will loop until the extractor value is no longer found

  • No labels