Skip to content

Instantly share code, notes, and snippets.

@marionzualo
Forked from stevegrossi/jmeter.rb
Created June 15, 2016 06:14
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 marionzualo/0d725f25e697f80a4f9db78fecbed232 to your computer and use it in GitHub Desktop.
Save marionzualo/0d725f25e697f80a4f9db78fecbed232 to your computer and use it in GitHub Desktop.
Sample JMeter test plan using the ruby-jmeter gem
#!/usr/bin/env ruby
require 'ruby-jmeter'
test do
defaults domain: 'beta.stevegrossi.com'
cookies clear_each_iteration: true
threads count: 10, loops: 1 do
extract name: 'authenticity_token',
regex: 'meta name="csrf-token" content="(.+?)"'
think_time 5000, 2000
transaction 'Log In and View All Books' do
visit '/meta/in' do
assert contains: 'Sign in', scope: 'main'
end
submit '/meta/in', {
always_encode: true,
fill_in: {
'utf8' => '✓',
'authenticity_token' => '${authenticity_token}',
'user[email]' => 'test@example.com',
'user[password]' => 'p455w0rd',
'commit' => 'Sign in',
}
} do
assert contains: 'Dashboard', scope: 'main'
end
visit '/meta/books' do
assert contains: 'Everything I’ve read', scope: 'main'
end
end
end
view_results_tree
summary_report
end.run(gui: true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment