Skip to content

Instantly share code, notes, and snippets.

@stevegrossi
Last active March 19, 2018 16:16
Show Gist options
  • Save stevegrossi/351e031240d683fa1481 to your computer and use it in GitHub Desktop.
Save stevegrossi/351e031240d683fa1481 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]' => '[email protected]',
'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