Some test cases that have 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 /wizard-step (#4) response from the previous loop iteration.
- Create an extractor called stepId from /start-wizard (#3) response.
- Use this extractor to parameterize the step_id request field in /wizard-step (#4).
- Create an extractor called stepId2 from /start-wizard (#4) response.
- Set the Copy value to Extractor property to stepId.
- No labels