cucumber-performance 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cucumber-performance/cucumber-steps.rb +31 -38
- data/lib/cucumber-performance/functions.rb +226 -58
- data/lib/cucumber-performance/views/index.html.erb +184 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0598030735a9b4165aa7f6d1b1e47375e2b7f49
|
4
|
+
data.tar.gz: ca3838b3e324dc34f9260387302845d14b00543d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a2a4f0e8fe82e89d0c8efac1ae697a66bf599c38f3791a92e55c41a7f78f9b414d174697f585a15dd06ac7937056cc4c278b219f5805ee3a03ce4aad925b27
|
7
|
+
data.tar.gz: 398a0c7d45416fe62056f957887ad58fe61aa26ba5154272cbd9ada58b3cb506cb2907f574e52090139978f80713073787689450293d8ea2c6b97a409440a1c3
|
@@ -35,69 +35,61 @@ Given(/^I want to run a performance$/) do
|
|
35
35
|
|
36
36
|
# Start the graph x axes
|
37
37
|
$max_x = 3
|
38
|
+
$trans_max_x = 3
|
39
|
+
|
40
|
+
# The running scenarios
|
41
|
+
$running_scenarios_hash = {}
|
42
|
+
|
43
|
+
# The amount of V users
|
44
|
+
$amount_of_users = 0
|
45
|
+
|
46
|
+
# Running v user scenario
|
47
|
+
$vuser_scenarios = []
|
48
|
+
|
49
|
+
# How many errors per a scenario
|
50
|
+
$scenario_errors = {}
|
51
|
+
|
52
|
+
$scenario_iterations = {}
|
53
|
+
|
54
|
+
$transactions_iterations= {}
|
38
55
|
|
39
56
|
# Start a controller, this is a GUI to allow you to monitor the test.
|
40
57
|
# This uses sinatra and is accessable by: http://localhost:4567
|
41
58
|
controller_thread = Thread.new{controller}
|
42
59
|
|
43
|
-
# Runs Cucumber to get a list of tests. This will be reworked in the future
|
44
|
-
args = []
|
45
|
-
args << '--dry-run'
|
46
|
-
args << '--format'
|
47
|
-
args << 'json'
|
48
|
-
|
49
60
|
@in = StringIO.new
|
50
61
|
@out = StringIO.new
|
51
62
|
@err = StringIO.new
|
52
63
|
|
53
|
-
begin
|
54
|
-
cuke = Cucumber::Cli::Main.new(args, @in, @out, @err).execute!
|
55
|
-
rescue Exception=>e
|
56
|
-
# Do nothing!
|
57
|
-
end
|
58
|
-
|
59
|
-
$features_hash = {}
|
60
|
-
|
61
|
-
$scenario_steps = {}
|
62
|
-
|
63
|
-
JSON.parse(@out.string).each do |features|
|
64
|
-
features['elements'].each do |scenarios|
|
65
|
-
$features_hash[scenarios['name'].to_s] = features['uri'].to_s + ':' + scenarios['line'].to_s
|
66
|
-
$scenario_steps[features['uri'].to_s + ':' + scenarios['line'].to_s] = []
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
64
|
end
|
71
65
|
|
72
66
|
Given(/^I have the following scenarios$/) do |table|
|
73
67
|
|
74
68
|
# This will use the cucumber call above to work out if the scenario you've enter
|
75
69
|
# is valid and can be run.
|
76
|
-
$running_scenarios_hash = {}
|
77
|
-
|
78
|
-
$running_scenarios_hash_name = {}
|
79
|
-
|
80
|
-
$amount_of_users = 0
|
81
|
-
|
82
|
-
$vuser_scenarios = []
|
83
70
|
|
84
71
|
table.raw.each do |value|
|
85
|
-
if (!$features_hash[value[0]].nil?)
|
86
|
-
$amount_of_users = $amount_of_users + value[1].to_i
|
87
|
-
$running_scenarios_hash[$features_hash[value[0]]] = value[1].to_i
|
88
|
-
$running_scenarios_hash_name[$features_hash[value[0]]] = value[0]
|
89
72
|
|
73
|
+
if value[0] != 'SCENARIO' then
|
90
74
|
for i in 0..value[1].to_i - 1
|
91
|
-
$vuser_scenarios <<
|
75
|
+
$vuser_scenarios << value[0]
|
92
76
|
end
|
93
77
|
|
78
|
+
$scenario_errors[value[0]] = 0
|
79
|
+
$scenario_iterations[value[0]] = 0
|
80
|
+
|
81
|
+
$results_scenarios_graph[value[0]] = []
|
82
|
+
|
83
|
+
$amount_of_users = $amount_of_users + value[1].to_i
|
84
|
+
$running_scenarios_hash[value[0]] = value[1].to_i
|
85
|
+
|
94
86
|
begin
|
95
87
|
load File.expand_path('performanceTests/' + value[0].gsub('(','').gsub(')', '').gsub(/ /, '_').capitalize.downcase + '.rb')
|
96
88
|
rescue Exception=>e
|
97
|
-
raise "Unable to load: " + File.expand_path('performanceTests/' + value[0].gsub('(','').gsub(')', '').gsub(/ /, '_').capitalize.downcase + '.rb')
|
89
|
+
raise "Unable to load: " + File.expand_path('performanceTests/' + value[0].gsub('(','').gsub(')', '').gsub(/ /, '_').capitalize.downcase + '.rb')
|
98
90
|
end
|
99
|
-
|
100
91
|
end
|
92
|
+
|
101
93
|
end
|
102
94
|
|
103
95
|
$vuser_scenarios.shuffle
|
@@ -202,6 +194,7 @@ When(/^I run the performance test$/) do
|
|
202
194
|
# Once the performance test has finished the sinatra app stops,
|
203
195
|
# this gets around that by visiting the page and producing a pdf output
|
204
196
|
visit('http://localhost:4567')
|
197
|
+
sleep(1)
|
205
198
|
save_screenshot("performance-#{Time.new.to_i}.pdf")
|
206
199
|
|
207
200
|
end
|
@@ -216,7 +209,7 @@ Then(/^the scenarios response times were below:$/) do |table|
|
|
216
209
|
table.raw.each do |value|
|
217
210
|
if (value[0] != 'SCENARIO')
|
218
211
|
# We need to get the average of the scenarios and then devide that by 1000 because they are in miliseconds
|
219
|
-
response_time = ($results_scenarios[
|
212
|
+
response_time = ($results_scenarios[value[0]].inject{ |sum, el| sum + el }.to_f / $results_scenarios[value[0]].size) / 1000
|
220
213
|
# Assert to see if the response time is below the threshold
|
221
214
|
assert_operator response_time, :<, value[1].to_i, 'The average response time wasn\'t below the threshold (' + value[0] + ')'
|
222
215
|
end
|
@@ -22,7 +22,7 @@ def loadtest()
|
|
22
22
|
$vuser_inc = $vuser_inc + 1
|
23
23
|
|
24
24
|
# convervate the cucumber scenario name, into the class name
|
25
|
-
scenario_name =
|
25
|
+
scenario_name = cucumber_scenario.gsub('(','').gsub(')', '').gsub(/ /, '_').capitalize
|
26
26
|
|
27
27
|
# create an instance of the class from the (step_defitions/performance) file
|
28
28
|
script = Module.const_get(scenario_name).new
|
@@ -45,49 +45,58 @@ def loadtest()
|
|
45
45
|
# Call the threads action step
|
46
46
|
script.v_action()
|
47
47
|
|
48
|
+
# As the test has finished, work out the duration
|
49
|
+
script_duration = (Time.now - scriptstart_time) * 1000
|
50
|
+
|
51
|
+
# If the duration is above the x axis current value, let's increase it
|
52
|
+
if ((script_duration / 1000) > $max_x) then
|
53
|
+
$max_x = (script_duration / 1000).ceil + 1
|
54
|
+
end
|
55
|
+
|
56
|
+
# If the current cucumber scenario have no results, lets define their arrays
|
57
|
+
if ($results_scenarios[cucumber_scenario].nil?) then
|
58
|
+
$results_scenarios[cucumber_scenario] = []
|
59
|
+
$results_scenarios_graph[cucumber_scenario] = {}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Add the duration of the test to an array so we can work our max/min/avg etc...
|
63
|
+
$results_scenarios[cucumber_scenario] << script_duration
|
64
|
+
|
65
|
+
# For each second we need to build up an average, so need to build up another array
|
66
|
+
# based on the current time
|
67
|
+
current_time_id = $duration - (($starttime + $duration) - Time.new.to_i) + 1
|
68
|
+
|
69
|
+
# If the array doesn't exist for the current time, then lets define it
|
70
|
+
if($results_scenarios_graph[cucumber_scenario][current_time_id].nil? == true) then
|
71
|
+
$results_scenarios_graph[cucumber_scenario][current_time_id] = Array.new()
|
72
|
+
end
|
73
|
+
|
74
|
+
# Add the value to the array
|
75
|
+
$results_scenarios_graph[cucumber_scenario][current_time_id].push(script_duration)
|
76
|
+
|
48
77
|
rescue Exception=>e
|
49
78
|
# If it fails, keep a log of why, then carry on
|
50
79
|
|
51
80
|
error = {}
|
52
|
-
error['error_message'] = e
|
81
|
+
error['error_message'] = e.to_s + '<br>' + e.backtrace.to_s
|
53
82
|
error['error_iteration'] = iteration
|
54
83
|
error['error_script'] = cucumber_scenario
|
55
84
|
|
85
|
+
# $stdout.puts 'Error: ' + e + "\n" + backtrace.map {|l| " #{l}\n"}.join
|
56
86
|
|
57
|
-
$error_log << error
|
58
87
|
|
59
|
-
$
|
60
|
-
$stdout.puts e
|
61
|
-
end
|
88
|
+
$scenario_errors[cucumber_scenario] += 1
|
62
89
|
|
63
|
-
|
64
|
-
script_duration = (Time.now - scriptstart_time) * 1000
|
90
|
+
#$stdout.puts $scenario_errors
|
65
91
|
|
66
|
-
|
67
|
-
if ((script_duration / 1000) > $max_x) then
|
68
|
-
$max_x = (script_duration / 1000).ceil + 1
|
69
|
-
end
|
92
|
+
$error_log << error
|
70
93
|
|
71
|
-
|
72
|
-
|
73
|
-
$results_scenarios[cucumber_scenario] = []
|
74
|
-
$results_scenarios_graph[cucumber_scenario] = {}
|
94
|
+
$total_failures += 1
|
95
|
+
# $stdout.puts 'Error: ' + e + "\n" + backtrace.map {|l| " #{l}\n"}.join
|
75
96
|
end
|
76
97
|
|
77
|
-
|
78
|
-
$results_scenarios[cucumber_scenario] << script_duration
|
79
|
-
|
80
|
-
# For each second we need to build up an average, so need to build up another array
|
81
|
-
# based on the current time
|
82
|
-
current_time_id = $duration - (($starttime + $duration) - Time.new.to_i) + 1
|
83
|
-
|
84
|
-
# If the array doesn't exist for the current time, then lets define it
|
85
|
-
if($results_scenarios_graph[cucumber_scenario][current_time_id].nil? == true) then
|
86
|
-
$results_scenarios_graph[cucumber_scenario][current_time_id] = Array.new()
|
87
|
-
end
|
98
|
+
$scenario_iterations[cucumber_scenario] += 1
|
88
99
|
|
89
|
-
# Add the value to the array
|
90
|
-
$results_scenarios_graph[cucumber_scenario][current_time_id].push(script_duration)
|
91
100
|
|
92
101
|
# Sleep a second between each scenario. This will need to be parametised soon
|
93
102
|
sleep(1)
|
@@ -122,6 +131,12 @@ end
|
|
122
131
|
#####
|
123
132
|
def end_traction(step_name, start_time)
|
124
133
|
|
134
|
+
if ($transactions_iterations[step_name].nil?) then
|
135
|
+
$transactions_iterations[step_name] = 0
|
136
|
+
end
|
137
|
+
|
138
|
+
$transactions_iterations[step_name] += 1
|
139
|
+
|
125
140
|
# This uses the value from start_traction() and finds how long the test took.
|
126
141
|
transaction_duration = (Time.now - start_time) * 1000
|
127
142
|
|
@@ -156,8 +171,6 @@ end
|
|
156
171
|
#####
|
157
172
|
def http_get(curl, data, url)
|
158
173
|
|
159
|
-
#puts 'GET: ' + url
|
160
|
-
|
161
174
|
# Define the url we want to hit
|
162
175
|
curl.url=url
|
163
176
|
|
@@ -266,71 +279,218 @@ def controller()
|
|
266
279
|
# Sets the graph data for [0] (vusers) to 0, stops an error
|
267
280
|
data['graph_data'][0][0] = 0
|
268
281
|
|
269
|
-
|
270
|
-
|
282
|
+
if (!$starttime.nil?) then
|
283
|
+
|
284
|
+
# Loops through each second to get the graph data
|
285
|
+
for i in 0..((Time.new.to_i - $starttime ))
|
271
286
|
|
272
|
-
|
273
|
-
|
287
|
+
# The [0] is for v users
|
288
|
+
data['graph_data'][0][i] = $results_vusers[i + 1]
|
274
289
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
290
|
+
num = 0
|
291
|
+
# Anthing above [0] is for the running tests
|
292
|
+
$results_scenarios_graph.each do |key, results2|
|
293
|
+
num = num + 1
|
294
|
+
if (results2[i + 1].nil? == false) then
|
280
295
|
|
281
|
-
|
282
|
-
|
296
|
+
sum = 0
|
297
|
+
results2[i + 1].each { |a| sum+=a }
|
283
298
|
|
284
|
-
|
285
|
-
|
286
|
-
|
299
|
+
# Add the results to the json object
|
300
|
+
data['graph_data'][num][i] = ((sum / results2[i + 1].size.to_f) / 1000).round(2)
|
301
|
+
|
302
|
+
if (data['graph_data'][num][i] > $max_x) then
|
303
|
+
$max_x = data['graph_data'][num][i]
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|
287
307
|
end
|
288
308
|
end
|
289
309
|
end
|
290
310
|
|
291
|
-
|
311
|
+
data['graph_y2max'] = ($max_x * 1.1)
|
292
312
|
|
293
313
|
# Define the objects for the overview of the cucumber scenarios (table below graph)
|
294
314
|
data['graph_details_name'] = []
|
295
315
|
data['graph_details_min'] = []
|
296
316
|
data['graph_details_max'] = []
|
297
317
|
data['graph_details_avg'] = []
|
318
|
+
data['graph_details_err'] = []
|
319
|
+
data['graph_details_ite'] = []
|
320
|
+
data['graph_details_per'] = []
|
298
321
|
|
299
322
|
data['graph_details_name'][0] = 'Vusers'
|
300
323
|
|
301
324
|
# If the data exists then use it, otherwise set it to 0
|
302
325
|
if (!data['graph_data'].nil?) then
|
303
|
-
|
304
|
-
|
305
|
-
|
326
|
+
|
327
|
+
if (data['graph_data'][0].nil?) then
|
328
|
+
data['graph_data'][0] = []
|
329
|
+
end
|
330
|
+
|
331
|
+
if (data['graph_data'][0].count > 1)
|
332
|
+
data['graph_details_avg'][0] = (data['graph_data'][0].inject{ |sum, el| sum + el }.to_f / data['graph_data'][0].size).round(2)
|
333
|
+
data['graph_details_min'][0] = data['graph_data'][0].min.round(2)
|
334
|
+
data['graph_details_max'][0] = data['graph_data'][0].max.round(2)
|
335
|
+
else
|
336
|
+
data['graph_details_avg'][0] = 0
|
337
|
+
data['graph_details_min'][0] = 0
|
338
|
+
data['graph_details_max'][0] = 0
|
339
|
+
end
|
340
|
+
|
341
|
+
data['graph_details_err'][0] = 0
|
342
|
+
data['graph_details_ite'][0] = 0
|
343
|
+
data['graph_details_per'][0] = 0
|
344
|
+
|
306
345
|
else
|
307
346
|
data['graph_details_min'][0] = 0
|
308
347
|
data['graph_details_max'][0] = 0
|
309
348
|
data['graph_details_avg'][0] = 0
|
349
|
+
data['graph_details_err'][0] = 0
|
350
|
+
data['graph_details_ite'][0] = 0
|
351
|
+
data['graph_details_per'][0] = 0
|
352
|
+
|
310
353
|
end
|
311
354
|
|
355
|
+
i = 0
|
356
|
+
#puts $results_scenarios_graph.count
|
312
357
|
# This is the same as above, but for tests, not the vusers
|
313
|
-
|
358
|
+
$results_scenarios_graph.each do |key, results2|
|
359
|
+
|
360
|
+
i += 1
|
361
|
+
data['graph_details_name'][i] = key
|
362
|
+
|
363
|
+
if (!$results_scenarios[key].nil?) then
|
364
|
+
|
365
|
+
if ($results_scenarios[key].count > 1)
|
366
|
+
data['graph_details_avg'][i] = (($results_scenarios[key].inject{ |sum, el| sum + el }.to_f / $results_scenarios[key].size) / 1000).round(2)
|
367
|
+
data['graph_details_min'][i] = ($results_scenarios[key].min / 1000).round(2)
|
368
|
+
data['graph_details_max'][i] = ($results_scenarios[key].max / 1000).round(2)
|
369
|
+
data['graph_details_per'][i] = (percentile($results_scenarios[key], 0.9) / 1000).round(2)
|
370
|
+
else
|
371
|
+
data['graph_details_avg'][i] = 0
|
372
|
+
data['graph_details_min'][i] = 0
|
373
|
+
data['graph_details_max'][i] = 0
|
374
|
+
data['graph_details_per'][i] = 0
|
375
|
+
end
|
376
|
+
else
|
377
|
+
|
378
|
+
data['graph_details_min'][i] = 0
|
379
|
+
data['graph_details_max'][i] = 0
|
380
|
+
data['graph_details_avg'][i] = 0
|
381
|
+
data['graph_details_per'][i] = 0
|
382
|
+
|
383
|
+
end
|
384
|
+
|
385
|
+
data['graph_details_err'][i] = $scenario_errors[key]
|
386
|
+
data['graph_details_ite'][i] = $scenario_iterations[key]
|
387
|
+
|
388
|
+
|
389
|
+
end
|
390
|
+
|
314
391
|
|
315
|
-
data['graph_details_name'][i + 1] = $list_of_tests[i]
|
316
392
|
|
317
|
-
if (!$results_scenarios[$list_of_tests[i]].nil?) then
|
318
393
|
|
319
|
-
data['graph_details_min'][i + 1] = ($results_scenarios[$list_of_tests[i]].min / 1000).round(2)
|
320
|
-
data['graph_details_max'][i + 1] = ($results_scenarios[$list_of_tests[i]].max / 1000).round(2)
|
321
|
-
data['graph_details_avg'][i + 1] = (($results_scenarios[$list_of_tests[i]].inject{ |sum, el| sum + el }.to_f / $results_scenarios[$list_of_tests[i]].size) / 1000).round(2)
|
322
394
|
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
# This is the array of data for each scenario for the graph
|
405
|
+
data['trans_graph_data'] = []
|
406
|
+
|
407
|
+
# Define the graph data objects
|
408
|
+
for i in 0..30
|
409
|
+
data['trans_graph_data'][i] = []
|
410
|
+
end
|
411
|
+
|
412
|
+
# Work out the xmax and ymax
|
413
|
+
data['trans_graph_xmax'] = (($graph_time || 0) * 1.05).ceil.to_s
|
414
|
+
|
415
|
+
# Sets the graph data for [0] (vusers) to 0, stops an error
|
416
|
+
|
417
|
+
#$stdout.puts $results_transactions_graph
|
418
|
+
|
419
|
+
if (!$starttime.nil?) then
|
420
|
+
|
421
|
+
# Loops through each second to get the graph data
|
422
|
+
for i in 0..((Time.new.to_i - $starttime ))
|
423
|
+
|
424
|
+
num = 0
|
425
|
+
# Anthing above [0] is for the running tests
|
426
|
+
$results_transactions_graph.each do |key, results2|
|
427
|
+
if (results2[i + 1].nil? == false) then
|
428
|
+
|
429
|
+
sum = 0
|
430
|
+
results2[i + 1].each { |a| sum+=a }
|
431
|
+
|
432
|
+
# Add the results to the json object
|
433
|
+
data['trans_graph_data'][num][i] = ((sum / results2[i + 1].size.to_f) / 1000).round(2)
|
434
|
+
if (data['trans_graph_data'][num][i] > $trans_max_x) then
|
435
|
+
$trans_max_x = data['trans_graph_data'][num][i]
|
436
|
+
end
|
437
|
+
|
438
|
+
end
|
439
|
+
num = num + 1
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
444
|
+
data['trans_graph_ymax'] = ($trans_max_x * 1.1)
|
445
|
+
|
446
|
+
data['trans_graph_details_name'] = []
|
447
|
+
data['trans_graph_details_min'] = []
|
448
|
+
data['trans_graph_details_max'] = []
|
449
|
+
data['trans_graph_details_avg'] = []
|
450
|
+
data['trans_graph_details_err'] = []
|
451
|
+
data['trans_graph_details_ite'] = []
|
452
|
+
data['trans_graph_details_per'] = []
|
453
|
+
|
454
|
+
i = 0
|
455
|
+
#puts $results_transactions_graph.count
|
456
|
+
# This is the same as above, but for tests, not the vusers
|
457
|
+
$results_transactions_graph.each do |key, results2|
|
458
|
+
|
459
|
+
|
460
|
+
data['trans_graph_details_name'][i] = key
|
461
|
+
|
462
|
+
if (!$results_transactions[key].nil?) then
|
463
|
+
|
464
|
+
if ($results_transactions[key].count > 1)
|
465
|
+
data['trans_graph_details_avg'][i] = (($results_transactions[key].inject{ |sum, el| sum + el }.to_f / $results_transactions[key].size) / 1000).round(2)
|
466
|
+
data['trans_graph_details_min'][i] = ($results_transactions[key].min / 1000).round(2)
|
467
|
+
data['trans_graph_details_max'][i] = ($results_transactions[key].max / 1000).round(2)
|
468
|
+
data['trans_graph_details_per'][i] = (percentile($results_transactions[key], 0.9) / 1000).round(2)
|
469
|
+
else
|
470
|
+
data['trans_graph_details_avg'][i] = 0
|
471
|
+
data['trans_graph_details_min'][i] = 0
|
472
|
+
data['trans_graph_details_max'][i] = 0
|
473
|
+
data['trans_graph_details_per'][i] = 0
|
474
|
+
end
|
323
475
|
else
|
324
476
|
|
325
|
-
data['
|
326
|
-
data['
|
327
|
-
data['
|
477
|
+
data['trans_graph_details_min'][i] = 0
|
478
|
+
data['trans_graph_details_max'][i] = 0
|
479
|
+
data['trans_graph_details_avg'][i] = 0
|
480
|
+
data['trans_graph_details_per'][i] = 0
|
328
481
|
|
329
482
|
end
|
330
483
|
|
484
|
+
if (!$transactions_iterations[key].nil?)
|
485
|
+
data['trans_graph_details_ite'][i] = $transactions_iterations[key]
|
486
|
+
else
|
487
|
+
data['trans_graph_details_ite'][i] = 0
|
488
|
+
end
|
489
|
+
i += 1
|
331
490
|
end
|
332
491
|
|
333
492
|
|
493
|
+
|
334
494
|
# Print the output as a json string
|
335
495
|
return data.to_json
|
336
496
|
end
|
@@ -346,3 +506,11 @@ def controller()
|
|
346
506
|
$sinatra_instance.run!
|
347
507
|
|
348
508
|
end
|
509
|
+
|
510
|
+
def percentile(values, percentile)
|
511
|
+
values_sorted = values.sort
|
512
|
+
k = (percentile*(values_sorted.length-1)+1).floor - 1
|
513
|
+
f = (percentile*(values_sorted.length-1)+1).modulo(1)
|
514
|
+
|
515
|
+
return values_sorted[k] + (f * (values_sorted[k+1] - values_sorted[k]))
|
516
|
+
end
|
@@ -17,22 +17,21 @@
|
|
17
17
|
</body>
|
18
18
|
|
19
19
|
<script class="code" type="text/javascript">
|
20
|
-
<%= @logfile %>
|
21
|
-
|
22
20
|
|
23
21
|
seriesColorsMaster = [ "#4bb2c5", "#c5b47f", "#EAA228", "#579575", "#839557", "#958c12",
|
24
|
-
"#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc"
|
22
|
+
"#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc",
|
23
|
+
"#00b2c5", "#00b47f", "#00A228", "#009575", "#009557", "#008c12",
|
24
|
+
"#003579", "#005de4", "#00b83f", "#005800", "000000",
|
25
|
+
"#4b00c5", "#c5007f", "#EA0028", "#570075", "#830057", "#950012",
|
26
|
+
"#950079", "#4b00e4", "#d8003f", "#ff0000", "#0000cc"
|
27
|
+
]
|
25
28
|
|
26
29
|
graph_ymax = 0
|
27
30
|
graph_y2max = 0
|
28
31
|
graph_xmax = 0
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
graph_trans_ymax = 0
|
34
|
+
graph_trans_ymax = 0
|
36
35
|
|
37
36
|
</script>
|
38
37
|
|
@@ -44,9 +43,12 @@ graph_xmax = 0
|
|
44
43
|
<tr>
|
45
44
|
<th>Colour</th>
|
46
45
|
<th>Name</th>
|
47
|
-
<th>
|
48
|
-
<th>
|
49
|
-
<th>
|
46
|
+
<th>Iterations</th>
|
47
|
+
<th>Errors</th>
|
48
|
+
<th>Min Time</th>
|
49
|
+
<th>Avg Time</th>
|
50
|
+
<th>Max Time</th>
|
51
|
+
<th>90th Per</th>
|
50
52
|
</tr>
|
51
53
|
</thead>
|
52
54
|
<tbody class="tablebody">
|
@@ -56,12 +58,39 @@ graph_xmax = 0
|
|
56
58
|
<td></td>
|
57
59
|
<td></td>
|
58
60
|
<td></td>
|
61
|
+
<td></td>
|
62
|
+
<td></td>
|
59
63
|
</tr>
|
60
64
|
</tbody>
|
61
65
|
</table>
|
62
66
|
</div>
|
63
67
|
|
64
68
|
<br>
|
69
|
+
<div id="chartdiv_trans" style="height:400px;width:800px; "></div>
|
70
|
+
|
71
|
+
</body>
|
72
|
+
<br>
|
73
|
+
<b>Information:</b>
|
74
|
+
<div class="bs-example">
|
75
|
+
<table class="table">
|
76
|
+
<thead>
|
77
|
+
<tr>
|
78
|
+
<th>Colour</th>
|
79
|
+
<th>Name</th>
|
80
|
+
<th>Iterations</th>
|
81
|
+
<th>Min Time</th>
|
82
|
+
<th>Avg Time</th>
|
83
|
+
<th>Max Time</th>
|
84
|
+
<th>90th Per</th>
|
85
|
+
</tr>
|
86
|
+
</thead>
|
87
|
+
<tbody class="tablebody_trans">
|
88
|
+
</tbody>
|
89
|
+
</table>
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<br>
|
93
|
+
|
65
94
|
<b>Errors:</b>
|
66
95
|
<div class="bs-example">
|
67
96
|
<table class="table">
|
@@ -92,7 +121,7 @@ function renderGraph() {
|
|
92
121
|
plot1.destroy();
|
93
122
|
}
|
94
123
|
plot1 = $.jqplot('chartdiv', [graph_data1, graph_data2, graph_data3, graph_data4, graph_data5, graph_data6, graph_data7, graph_data8, graph_data9, graph_data10],
|
95
|
-
{ title:'Performance Test',
|
124
|
+
{ title:'Performance Test (Scenarios)',
|
96
125
|
seriesColors: seriesColorsMaster,
|
97
126
|
axes:{yaxis:{label: 'VUsers', min:0, max:graph_ymax},
|
98
127
|
y2axis: {label: 'Response', min:0, max:graph_y2max},
|
@@ -108,6 +137,26 @@ function renderGraph() {
|
|
108
137
|
|
109
138
|
}
|
110
139
|
|
140
|
+
function trans_renderGraph() {
|
141
|
+
if (typeof plot2 !== 'undefined') {
|
142
|
+
plot2.destroy();
|
143
|
+
}
|
144
|
+
plot2 = $.jqplot('chartdiv_trans', [graph_trans_data1, graph_trans_data2, graph_trans_data3, graph_trans_data4, graph_trans_data5, graph_trans_data6, graph_trans_data7, graph_trans_data8, graph_trans_data9, graph_trans_data10,
|
145
|
+
graph_trans_data11, graph_trans_data12, graph_trans_data13, graph_trans_data14, graph_trans_data15, graph_trans_data16, graph_trans_data17, graph_trans_data18, graph_trans_data19, graph_trans_data20,
|
146
|
+
graph_trans_data21, graph_trans_data22, graph_trans_data23, graph_trans_data24, graph_trans_data25, graph_trans_data26, graph_trans_data27, graph_trans_data28, graph_trans_data29, graph_trans_data30],
|
147
|
+
{ title:'Performance Test (Transactions)',
|
148
|
+
seriesColors: seriesColorsMaster,
|
149
|
+
axes:{yaxis:{label: 'Response', min:0, max:graph_trans_ymax},
|
150
|
+
xaxis:{min:0, max:graph_trans_xmax, numberTicks: 10}
|
151
|
+
},
|
152
|
+
series: [
|
153
|
+
{ yaxis: "yaxis" },
|
154
|
+
]
|
155
|
+
|
156
|
+
|
157
|
+
});
|
158
|
+
|
159
|
+
}
|
111
160
|
|
112
161
|
function get_graph_data() {
|
113
162
|
|
@@ -140,7 +189,6 @@ $.getJSON( "/data", function( json ) {
|
|
140
189
|
graph_data9 = json.graph_data[8];
|
141
190
|
graph_data10 = json.graph_data[9];
|
142
191
|
|
143
|
-
|
144
192
|
graph_details_name = [];
|
145
193
|
graph_details_min = [];
|
146
194
|
graph_details_max = [];
|
@@ -150,8 +198,9 @@ $.getJSON( "/data", function( json ) {
|
|
150
198
|
graph_details_min = json.graph_details_min;
|
151
199
|
graph_details_max = json.graph_details_max;
|
152
200
|
graph_details_avg = json.graph_details_avg;
|
153
|
-
|
154
|
-
|
201
|
+
graph_details_err = json.graph_details_err;
|
202
|
+
graph_details_ite = json.graph_details_ite;
|
203
|
+
graph_details_per = json.graph_details_per;
|
155
204
|
|
156
205
|
$( ".tablebody" ).html('')
|
157
206
|
|
@@ -159,7 +208,7 @@ $.getJSON( "/data", function( json ) {
|
|
159
208
|
//alert(graph_details[i]);
|
160
209
|
//Do something
|
161
210
|
|
162
|
-
$( ".tablebody" ).append( '<tr><td id="row' + (i + 1) + '"></td><td>' + graph_details_name[i] + '</td><td>' + graph_details_min[i] + '</td><td>' + graph_details_avg[i] + '</td><td>' + graph_details_max[i] + '</td></tr>');
|
211
|
+
$( ".tablebody" ).append( '<tr><td id="row' + (i + 1) + '"></td><td>' + graph_details_name[i] + '</td><td>' + graph_details_ite[i] + '</td><td>' + graph_details_err[i] + '</td><td>' + graph_details_min[i] + '</td><td>' + graph_details_avg[i] + '</td><td>' + graph_details_max[i] + '</td><td>' + graph_details_per[i] + '</td></tr>');
|
163
212
|
}
|
164
213
|
|
165
214
|
$('#row1').css('background',seriesColorsMaster[0]);
|
@@ -174,6 +223,124 @@ $.getJSON( "/data", function( json ) {
|
|
174
223
|
$('#row10').css('background',seriesColorsMaster[9]);
|
175
224
|
|
176
225
|
|
226
|
+
renderGraph()
|
227
|
+
|
228
|
+
graph_trans_data1 = [];
|
229
|
+
graph_trans_data2 = [];
|
230
|
+
graph_trans_data3 = [];
|
231
|
+
graph_trans_data4 = [];
|
232
|
+
graph_trans_data5 = [];
|
233
|
+
graph_trans_data6 = [];
|
234
|
+
graph_trans_data7 = [];
|
235
|
+
graph_trans_data8 = [];
|
236
|
+
graph_trans_data9 = [];
|
237
|
+
graph_trans_data10 = [];
|
238
|
+
graph_trans_data11 = [];
|
239
|
+
graph_trans_data12 = [];
|
240
|
+
graph_trans_data13 = [];
|
241
|
+
graph_trans_data14 = [];
|
242
|
+
graph_trans_data15 = [];
|
243
|
+
graph_trans_data16 = [];
|
244
|
+
graph_trans_data17 = [];
|
245
|
+
graph_trans_data18 = [];
|
246
|
+
graph_trans_data19 = [];
|
247
|
+
graph_trans_data20 = [];
|
248
|
+
graph_trans_data21 = [];
|
249
|
+
graph_trans_data22 = [];
|
250
|
+
graph_trans_data23 = [];
|
251
|
+
graph_trans_data24 = [];
|
252
|
+
graph_trans_data25 = [];
|
253
|
+
graph_trans_data26 = [];
|
254
|
+
graph_trans_data27 = [];
|
255
|
+
graph_trans_data28 = [];
|
256
|
+
graph_trans_data29 = [];
|
257
|
+
graph_trans_data30 = [];
|
258
|
+
|
259
|
+
graph_trans_data1 = json.trans_graph_data[0];
|
260
|
+
graph_trans_data2 = json.trans_graph_data[1];
|
261
|
+
graph_trans_data3 = json.trans_graph_data[2];
|
262
|
+
graph_trans_data4 = json.trans_graph_data[3];
|
263
|
+
graph_trans_data5 = json.trans_graph_data[4];
|
264
|
+
graph_trans_data6 = json.trans_graph_data[5];
|
265
|
+
graph_trans_data7 = json.trans_graph_data[6];
|
266
|
+
graph_trans_data8 = json.trans_graph_data[7];
|
267
|
+
graph_trans_data9 = json.trans_graph_data[8];
|
268
|
+
graph_trans_data10 = json.trans_graph_data[9];
|
269
|
+
graph_trans_data11 = json.trans_graph_data[10];
|
270
|
+
graph_trans_data12 = json.trans_graph_data[11];
|
271
|
+
graph_trans_data13 = json.trans_graph_data[12];
|
272
|
+
graph_trans_data14 = json.trans_graph_data[13];
|
273
|
+
graph_trans_data15 = json.trans_graph_data[14];
|
274
|
+
graph_trans_data16 = json.trans_graph_data[15];
|
275
|
+
graph_trans_data17 = json.trans_graph_data[16];
|
276
|
+
graph_trans_data18 = json.trans_graph_data[17];
|
277
|
+
graph_trans_data19 = json.trans_graph_data[18];
|
278
|
+
graph_trans_data20 = json.trans_graph_data[19];
|
279
|
+
graph_trans_data21 = json.trans_graph_data[20];
|
280
|
+
graph_trans_data22 = json.trans_graph_data[21];
|
281
|
+
graph_trans_data23 = json.trans_graph_data[22];
|
282
|
+
graph_trans_data24 = json.trans_graph_data[23];
|
283
|
+
graph_trans_data25 = json.trans_graph_data[24];
|
284
|
+
graph_trans_data26 = json.trans_graph_data[25];
|
285
|
+
graph_trans_data27 = json.trans_graph_data[26];
|
286
|
+
graph_trans_data28 = json.trans_graph_data[27];
|
287
|
+
graph_trans_data29 = json.trans_graph_data[28];
|
288
|
+
graph_trans_data30 = json.trans_graph_data[29];
|
289
|
+
|
290
|
+
graph_trans_ymax = json.trans_graph_ymax;
|
291
|
+
graph_trans_xmax = json.trans_graph_xmax;
|
292
|
+
|
293
|
+
trans_renderGraph()
|
294
|
+
|
295
|
+
trans_graph_details_name = json.trans_graph_details_name;
|
296
|
+
trans_graph_details_min = json.trans_graph_details_min;
|
297
|
+
trans_graph_details_max = json.trans_graph_details_max;
|
298
|
+
trans_graph_details_avg = json.trans_graph_details_avg;
|
299
|
+
trans_graph_details_ite = json.trans_graph_details_ite;
|
300
|
+
trans_graph_details_per = json.trans_graph_details_per;
|
301
|
+
|
302
|
+
$( ".tablebody_trans" ).html('')
|
303
|
+
|
304
|
+
for (var i = 0; i < trans_graph_details_name.length; i++) {
|
305
|
+
|
306
|
+
$( ".tablebody_trans" ).append( '<tr><td id="row_trans' + (i + 1) + '"></td><td>' + trans_graph_details_name[i] + '</td><td>' + trans_graph_details_ite[i] + '</td><td>' + trans_graph_details_min[i] + '</td><td>' + trans_graph_details_avg[i] + '</td><td>' + trans_graph_details_max[i] + '</td><td>' + trans_graph_details_per[i] + '</td></tr>');
|
307
|
+
}
|
308
|
+
|
309
|
+
$('#row_trans1').css('background',seriesColorsMaster[0]);
|
310
|
+
$('#row_trans2').css('background',seriesColorsMaster[1]);
|
311
|
+
$('#row_trans3').css('background',seriesColorsMaster[2]);
|
312
|
+
$('#row_trans4').css('background',seriesColorsMaster[3]);
|
313
|
+
$('#row_trans5').css('background',seriesColorsMaster[4]);
|
314
|
+
$('#row_trans6').css('background',seriesColorsMaster[5]);
|
315
|
+
$('#row_trans7').css('background',seriesColorsMaster[6]);
|
316
|
+
$('#row_trans8').css('background',seriesColorsMaster[7]);
|
317
|
+
$('#row_trans9').css('background',seriesColorsMaster[8]);
|
318
|
+
$('#row_trans10').css('background',seriesColorsMaster[9]);
|
319
|
+
$('#row_trans11').css('background',seriesColorsMaster[10]);
|
320
|
+
$('#row_trans12').css('background',seriesColorsMaster[11]);
|
321
|
+
$('#row_trans13').css('background',seriesColorsMaster[12]);
|
322
|
+
$('#row_trans14').css('background',seriesColorsMaster[13]);
|
323
|
+
$('#row_trans15').css('background',seriesColorsMaster[14]);
|
324
|
+
$('#row_trans16').css('background',seriesColorsMaster[15]);
|
325
|
+
$('#row_trans17').css('background',seriesColorsMaster[16]);
|
326
|
+
$('#row_trans18').css('background',seriesColorsMaster[17]);
|
327
|
+
$('#row_trans19').css('background',seriesColorsMaster[18]);
|
328
|
+
$('#row_trans20').css('background',seriesColorsMaster[19]);
|
329
|
+
$('#row_trans21').css('background',seriesColorsMaster[20]);
|
330
|
+
$('#row_trans22').css('background',seriesColorsMaster[21]);
|
331
|
+
$('#row_trans23').css('background',seriesColorsMaster[22]);
|
332
|
+
$('#row_trans24').css('background',seriesColorsMaster[23]);
|
333
|
+
$('#row_trans25').css('background',seriesColorsMaster[24]);
|
334
|
+
$('#row_trans26').css('background',seriesColorsMaster[25]);
|
335
|
+
$('#row_trans27').css('background',seriesColorsMaster[26]);
|
336
|
+
$('#row_trans28').css('background',seriesColorsMaster[27]);
|
337
|
+
$('#row_trans29').css('background',seriesColorsMaster[28]);
|
338
|
+
$('#row_trans30').css('background',seriesColorsMaster[29]);
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
$( ".errors" ).html('')
|
343
|
+
|
177
344
|
for (var i2 = 0; i2 < json.error_log.length; i2++) {
|
178
345
|
//alert(graph_details[i]);
|
179
346
|
//Do something
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|