Iam using the ruby-jmeter gem to write DSL scripts for doing performance tests automation..
I find this pretty useful to navigate to my API URLs, post data, assert for expected result and generate performance trends reports..
Iam getting stuck while using the extract regex: '', name: '' syntax in ruby-jmeter.
I want something like: I Visit http :// domain/api/user?q=create,
I post a raw JSON data as input and I get required JSON response. I want to extract a pattern from this response and use this value dynamically so that I can provide it as input to my raw JSON input to Visit http: //domain/api/user?q=read
Basically i was trying:
visit name: 'CreateUser', url: "<url link>",<br>
method: "post",<br>
domain: "<domain>",<br>
path: 'api/user?q=create', <br>
raw_body: <input json> do<br>
#extract a pattern from response<br>
extract regex: '"Username":"(.+?)"', name: 'userName'<br>
puts '${userName}'<br>
# rest of code here.. <br>
# I want to use ${username} as input to my next Visit call<br>
end
Can somebody who have looked into ruby-jmeter help me here plssss?
thanks, Vishi.