Skip to content

Instantly share code, notes, and snippets.

@mahm
Created November 23, 2014 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahm/5c565a2f1a1146dd2987 to your computer and use it in GitHub Desktop.
Save mahm/5c565a2f1a1146dd2987 to your computer and use it in GitHub Desktop.
ruby-jmeter sample
require 'ruby-jmeter'
test name: 'JMX Sample' do
threads count: 5, loops: 5 do
cookies
visit name: 'Login Page', url: 'http://0.0.0.0:3000/users/sign_in' do
extract name: 'csrf-token', xpath: "//meta[@name='csrf-token']/@content", tolerant: true
extract name: 'csrf-param', xpath: "//meta[@name='csrf-param']/@content", tolerant: true
end
http_header_manager name: 'X-CSRF-Token', value: '${csrf-token}'
submit name: 'Login', url: 'http://0.0.0.0:3000/users/sign_in',
fill_in: {
'${csrf-param}' => '${csrf-token}',
'user[email]' => 'qqqq@qqqq.com',
'user[password]' => 'qqqqqqqq'
}
visit name: 'Project', url: 'http://0.0.0.0:3000/projects/1'
visit name: 'Tasks', url: 'http://0.0.0.0:3000/projects/1/tasks/current'
end
view_results_in_table
graph_results
aggregate_graph
# Debug
# debug_sampler
# view_results_tree
end.jmx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment