gridinit-jmeter 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Gridinit::Jmeter
2
2
 
3
+ [![Code Climate](https://codeclimate.com/github/altentee/gridinit-jmeter.png)](https://codeclimate.com/github/altentee/gridinit-jmeter)
4
+
3
5
  Tired of using the JMeter GUI or looking at hairy XML files?
4
6
 
5
7
  This gem lets you write test plans for JMeter in your favourite text editor, and optionally run them on [Gridinit.com](http://gridinit.com). Here's some background on [why we think](http://www.slideshare.net/90kts/gridinit-jmeter) a DSL is necessary. Don't have Ruby? No problems, you can try out this DSL online in our [sandbox](http://sandbox.gridinit.com)
@@ -35,7 +37,12 @@ end.jmx
35
37
  So in this example, we just created a test plan, with 10 threads, each of which visited the search page at Google.
36
38
 
37
39
  ### Generating a JMeter Test Plan (JMX)
38
- Note also how we called the `jmx` method of the test. Calling this method will write the contents of the JMeter test plan to screen (stdout) and also to a file like this.
40
+ Note also how we called the `jmx` method of the test. Calling this method will write the contents of the JMeter test plan to file like this.
41
+
42
+ ```
43
+ $ ruby testplan.rb
44
+ [2013-04-23T10:29:03.275743 #42060] INFO -- : Test plan saved to: jmeter.jmx
45
+ ```
39
46
 
40
47
  ```xml
41
48
  <?xml version="1.0" encoding="UTF-8"?>
@@ -54,7 +61,7 @@ The file that is created can then be executed in the JMeter GUI. If you want to
54
61
  ```ruby
55
62
  test do
56
63
  threads 10 do
57
- visit 'Google Search', 'http://altentee.com'
64
+ visit 'Google Search', 'http://google.com'
58
65
  end
59
66
  end.jmx(file: "/tmp/my_testplan.jmx")
60
67
  ```
@@ -71,7 +78,7 @@ You can execute the JMeter test plan by calling the `run` method of the test lik
71
78
  ```ruby
72
79
  test do
73
80
  threads 10 do
74
- visit 'Google Search', 'http://altentee.com'
81
+ visit 'Google Search', 'http://google.com'
75
82
  end
76
83
  end.run
77
84
  ```
@@ -81,7 +88,7 @@ This will launch JMeter in headless (non-GUI mode) and execute the test plan. Th
81
88
  ```ruby
82
89
  test do
83
90
  threads 10 do
84
- visit 'Google Search', 'http://altentee.com'
91
+ visit 'Google Search', 'http://google.com'
85
92
  end
86
93
  end.run(
87
94
  path: '/usr/share/jmeter/bin/',
@@ -99,7 +106,7 @@ To execute the test on the Grid, call the `grid` method on the test and pass it
99
106
  ```ruby
100
107
  test do
101
108
  threads 10 do
102
- visit 'Google Search', 'http://altentee.com'
109
+ visit 'Google Search', 'http://google.com'
103
110
  end
104
111
  end.grid('OxtZ-4v-v0koSz5Y0enEQQ')
105
112
  ```
@@ -221,21 +228,21 @@ end
221
228
  You can use the `visit` method to navigate to pages:
222
229
 
223
230
  ```ruby
224
- visit 'Google Search', 'http://altentee.com'
231
+ visit 'Google Search', 'http://google.com'
225
232
  ```
226
233
 
227
234
  This method makes a single request and takes 3 parameters: the label, the URL and an optional parameters hash.
228
235
 
229
236
  ```ruby
230
- visit 'Google Search', 'http://altentee.com'
231
- visit 'Google Search', 'http://altentee.com', {
237
+ visit 'Google Search', 'http://google.com'
238
+ visit 'Google Search', 'http://google.com', {
232
239
  method: 'POST',
233
240
  DO_MULTIPART_POST: 'true'
234
241
  }
235
- visit 'Google Search', 'http://altentee.com', {
242
+ visit 'Google Search', 'http://google.com', {
236
243
  use_keepalive: 'false'
237
244
  }
238
- visit 'Google Search', 'http://altentee.com', {
245
+ visit 'Google Search', 'http://google.com', {
239
246
  connect_timeout: '1000',
240
247
  response_timeout: '60000',
241
248
  }
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["support@gridinit.com"]
11
11
  gem.description = %q{This is a Ruby based DSL for writing JMeter test plans}
12
12
  gem.summary = %q{This is a Ruby based DSL for writing JMeter test plans}
13
- gem.homepage = ""
13
+ gem.homepage = "http://github.com/altentee/gridinit-jmeter"
14
14
  gem.add_dependency("rest-client")
15
15
  gem.add_dependency("nokogiri")
16
16
  gem.add_runtime_dependency('json-jruby') if RUBY_PLATFORM == 'java'
@@ -333,7 +333,7 @@ module Gridinit
333
333
  def run(params={})
334
334
  file(params)
335
335
  logger.warn "Test executing locally ..."
336
- cmd = "#{params[:path]}jmeter -n -t #{params[:file]} -j #{params[:log] ? params[:log] : 'jmeter.log' } -l #{params[:jtl] ? params[:jtl] : 'jmeter.jtl' }"
336
+ cmd = "#{params[:path]}jmeter #{"-n" unless params[:gui] } -t #{params[:file]} -j #{params[:log] ? params[:log] : 'jmeter.log' } -l #{params[:jtl] ? params[:jtl] : 'jmeter.jtl' }"
337
337
  logger.debug cmd if params[:debug]
338
338
  Open3.popen2e("#{cmd} -q #{File.dirname(__FILE__)}/helpers/jmeter.properties") do |stdin, stdout_err, wait_thr|
339
339
  while line = stdout_err.gets