Is it possible to break a page-based web script into multiple transactions without losing session information?
In general it is not recommended to split web scripts into multiple transactions when you want to simulate a single user session as, by default, the replay engine simulates a browser shutdown at the end of each transaction thus mimicking real life. Instead you should record each user story (e.g user who browses and searches, or user who searches and buys) as a succinct transaction. If you want to break down specific areas of functionality you should do this through the use of functions in bdh files.
Nevertheless, there are occasions when you may want to separate functionality out into separate transactions, e.g. you may not want each user to log into the application each time as you are not interested in testing this specific functionality. in these cases you can maintain session information across transactions if you follow the following rules.
1. Break the script into transactions during the record process.
To do this use the New Transaction button in the recorder. Creating new transactions during record will ensure that cookies etc are set appropriately in each transaction.
NB If you break the script into multiple transactions manually, after recording a single transaction, then you will almost certainly lose session information.
2. Uncheck Choose transactions randomly
This will ensure that the transactions are run in the appropriate order. This setting is found in
Settings | Active Profile | Replay | Simulation | Simulation tab
3. Disable Simulate user behavior for each transaction
By default this setting is enabled. When enabled, the replay engine simulates a browser shutdown between transaction clearing the cache and cookie database for each user. This setting is found in:
Settings | Active Profile | Replay | Web | Simulation tab
If the multiple transaction script continues to fail it is worth recording and replaying as one transaction to determine whether this is having an effect.
Inserting a “New Transaction” via the Recorder results in cookies hard-coded into each transaction to maintain state / context between transactions.
If the user behavior is disabled (as suggested in 3 above) then some / all of the scripted WebCookieSet calls may be removed. First compare with a script recorded in a single transaction after clearing the browser cache and cookies – if the cookie does not occur then you should be safe to remove it.