I have 10 different __viewstate values in jmeter script. one is for login and others are for post methods. how can i use regular expression extractor to parameterize the viewstate for performance testing.
0
votes
You can use 1 regular expression with multiple matches. Did you look up the documentation for regex extractor?
– RaGe
So you want to use a regular expression extractor to grab 10 values from the page? Is this correct? Can you provide an example?
– jgabb
@jgabb Yes. Posted an answer below.
– RaGe
I was asking the OP =) @RaGe
– jgabb
@jgabb ah! that makes more sense. You sounded super-aggressive when I thought you were talking to me :)
– RaGe
2 Answers
1
votes
As per regular expression extractor documentation:
If the match number is set to a negative number, then all the possible matches in the sampler data are processed. The variables are set as follows:
- refName_matchNr - the number of matches found; could be 0
- refName_n, where n = 1,2,3 etc - the strings as generated by the template
- refName_n_gm, where m=0,1,2 - the groups for match n
- refName - always set to the default value
Set match number -1
for one expression to return all matches from the response.
0
votes
As RaGe mentioned in the comment, you can just use 1 Regular Expression Extractor to find all the matches for the given pattern.
Regular Expression Extractor - Example
MatchNo :
- 0 for random
- 1 for first match
- 2 for second match and so on.
- -1 for all matches
When you enter -1 & get all matches, to access the first match, use TheVariableName_1