Reputation: 9589
I'm trying to do some JMeter testing with a web service, but I'm a bit stymied on how to test the create/delete functionality.
Create is done by passing in some values. Delete, however, is only accomplished by using the created object's id, which must be obtained through a separate call. Thus, I'm not really sure how to set up JMeter to handle this.
Is it possible for, say, the return value of the create call (the object id) to be stored and then used in my delete request?
If anyone could help or point me in the right direction, it would be appreciated.
Upvotes: 3
Views: 3449
Reputation: 619
Using a JDBC request where
- variable name: mysql (if your db is mysql)
- select statement: select concat("id:'", id, "'") as id FROM your_table WHERE ...
To this jdbc request attach a regular expression extractor:
- reference name: retrieved_id --> so you can use it as ${retrieved_id}
- regular expression: id:'(.+?)
- template: $1$
Now in your tests you can use ${retrieved_id}
Upvotes: 0
Reputation: 31371
You can use the Post-Processor named "Regular Expression Extractor" to fetch the key into a local variable and use that for the next request.
also see this thread on the mailing list for a similar requirement
Upvotes: 2