While working on the Flight Booking Application,
I came
across a scenario wherein there were multiple flights needed to be cancelled.
The catch was that the count of flights to be cancelled was not fixed. Sometime,
it could be 3, sometime 7 etc.
The cancellation request recorded via LoadRunner (in HTML
mode) looked like below:
The solution to be above problem was to convert this request
into a custom request to dynamically handle the number of flights.
Below is what I did,
I changed the recording options as below:
Then I regenerated the script via below option:
The cancellation request, after regeneration looked like below:
After close observation I understood that there is a repetition of below code, for every flight to be cancelled:
flightID=225259643-798-jB&
flightID=43296680-1568-jB&
flightID=163444829-2337-jB&
and so on..
Additionally, there was a repetition of
below as well,
.cgifields=33&
.cgifields=32&
.cgifields=90& and so on..
1.
I need to handle these in such a way as to
capture each of these for every flight, concatenate them and then substitute in
the request in step 3 above.
1.
Below is the code for the same:
a.
Correlations
to be captured:-
b. Code Logic:-
c. Substitution in Cancellation Request:-
1.
Execution successful!!
Please note: There is a possibility that you might
get the below error message during the script re-run:-
To resolve the above, all you need to do is to
replace the failing request with its regenerated script counterpart. For ex: I
got this error at sign off. So I replaced the Sign Off request as below, i.e.
with its custom request:-
And the issue was resolved.
Cheers!!