Jmeter - get entire query string into variable
Is there a way to use the Regular Expression Extractor to grab the entire .NET encrypted query string and place it in a variable?
Example, for URL via a GET:
https:/www.website.com/folder/page.aspx?jfhjHSDjgdjhsjhsdhjSJHWed
I am trying to have ${myQueryString} = jfhjHSDjgdjhsjhsdhjSJHWed开发者_运维技巧
so I can replay it later in the test plan by appending the variable to a future GET.
First question, where do you get the GET url from, are you extracting it from the http request?
If you have it anyways either "hardcoded" or in jmeter variable you could add beanshell sampler to your test case and add the following code :
vars.put("queryParams","${__javaScript(/\?(.*)$/.exec('http://stackoverflow.com/questions/2389738/jmeter-get-entire-query-string-into-variable?testqueryparameter=&anotherqueryparam=IhavesomeValue')[1],)}");
I used http://stackoverflow.com/questions/2389738/jmeter-get-entire-query-string-into-variable?testqueryparameter=&anotherqueryparam=IhavesomeValue
to test this case.
The result store in variable queryParams
is testqueryparameter=&anotherqueryparam=IhavesomeValue
Is that what you were looking for?
(?<=\?)[^?]+$
will match everything after the last ?
in the string. I hope that's what you meant.
精彩评论