Vaibhav Jain
Vaibhav Jain

Reputation: 131

How to handle dynamically generated values during run time via Jmeter

Scenario: I am recording a script which is fetching values from CSV name and email. I have used ${email} and ${name} at the time which candidate is registering. Every time candidate register, unique instance Id is generated on the basis of which further action is performed.

Ex:

Candidate registers -> Unique Id (say 12345) -> ST : Start some test on the website -> Some responses saved for 12345 -> FT : Finish test on website

Need to perform the same for say 500 candidates. I am fetching unique email and name from csv.
How do i store/handle unique instance Id for each candidate dynamically and perform the entire operation?
Currently each operation is getting performed for same unique instance Id (12345) with 0% error.

Let me know if any other details needed for the same.


UPDATE from comments:

I can use say UniqueId whenever candidate registers using a RegEx Extractor or a XPath Extractor and i can pass that value in further process.
Now issue is i have to pass the stored variable in JSON.
No clue about that.

Upvotes: 0

Views: 5083

Answers (2)

Aliaksandr Belik
Aliaksandr Belik

Reputation: 12873

Since you've extracted UniqueId value using any extractor component it's stored in jmeter variable (pointed in the extractor's configuration) and can be referred as e.g. ${uniqueId}.

To pass into the further request you can use HTTP Request where in Post Body you can set your JSON request code with ${uniqueId} inserted in the right place. enter image description here

Upvotes: 1

void
void

Reputation: 1

You can use regular expression extractor in jmeter to extract required variable value and store reference it with a variable name .

Later it can be used in later requests by usin ${variablename}

In the regular expression extractor you can use perl5 regular expressions

Refer to this link for additional information: http://www.jmeter4u.com/2013/04/chapter-6-handling-dynamic-server-values.html

Upvotes: 0

Related Questions