What's the best strategy to use when writing JMeters tests against a web application where the values of certain query-string and post variables are going to change for each run.
Quick, common, example
- You go to a Web Page
- Enter some information into a form
- Click Save
- Behind the scenes, a new record is entered in the database
- You want to edit the record you just entered, so you go to another web page. Behind the scenes it's passing the page a parameter with the Database ID of the row you just created
When you're running step 5 of the above test, the page parameter/Database ID is going to change each time.
The workflow/strategy I'm currently using is
- Record a test using the above actions
- Make a note of each place where a query string variable may change from run to run
- Use a XPath or Regular Expression Extractor to pull the value out of a response and into a JMeter variable
- Replace all appropriate instances of the hard-coded parameter with the above variable.
This works and can be automated to an extent. However, it can get tedious, is error prone, and fragile. Is there a better/commonly accepted way of handling this situation? (Or is this why most people just use JMeter to play back logs? (-;)