rutemaweb 0.9.1 → 0.9.2
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.
- data/History.txt +3 -0
- data/lib/rutemaweb/main.rb +1 -1
- data/lib/rutemaweb/model.rb +6 -0
- data/lib/rutemaweb/ramaze_controller.rb +95 -33
- metadata +4 -4
data/History.txt
CHANGED
data/lib/rutemaweb/main.rb
CHANGED
data/lib/rutemaweb/model.rb
CHANGED
@@ -35,6 +35,9 @@ module Rutema
|
|
35
35
|
end
|
36
36
|
return st
|
37
37
|
end
|
38
|
+
def number_of_failed
|
39
|
+
self.scenarios.select{|sc| !sc.success?}.size
|
40
|
+
end
|
38
41
|
end
|
39
42
|
|
40
43
|
class Scenario <ActiveRecord::Base
|
@@ -51,6 +54,9 @@ module Rutema
|
|
51
54
|
:offset => page_num*page_size)
|
52
55
|
end
|
53
56
|
|
57
|
+
def success?
|
58
|
+
return self.status=="success"
|
59
|
+
end
|
54
60
|
end
|
55
61
|
end
|
56
62
|
end
|
@@ -22,7 +22,7 @@ module Rutema
|
|
22
22
|
#image filename to use for unexecuted steps
|
23
23
|
IMG_STEP_WARN="/images/step_warn.png"
|
24
24
|
#Time format to use for the start and stop times
|
25
|
-
TIME_FORMAT="%d/%m/%Y
|
25
|
+
TIME_FORMAT="%d/%m/%Y\n%H:%M:%S"
|
26
26
|
#The left arrow
|
27
27
|
IMG_LEFT="/images/left.png"
|
28
28
|
#The right arrow
|
@@ -33,11 +33,11 @@ module Rutema
|
|
33
33
|
when :warning ,"not_executed"
|
34
34
|
"<img src=\"#{IMG_STEP_WARN}\" align=\"center\"/>"
|
35
35
|
when :success, "success"
|
36
|
-
|
36
|
+
"<img src=\"#{IMG_STEP_OK}\" align=\"center\"/>"
|
37
37
|
when :error, "error"
|
38
|
-
|
38
|
+
"<img src=\"#{IMG_STEP_ERROR}\" align=\"center\"/>"
|
39
39
|
else
|
40
|
-
|
40
|
+
"<img src=\"#{IMG_STEP_WARN}\" align=\"center\"/>"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
# Returns a string with the correct time format for display
|
@@ -48,24 +48,28 @@ module Rutema
|
|
48
48
|
def run_url run
|
49
49
|
"/run/#{run.id}"
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def run_summary r
|
53
53
|
Ramaze::Log.debug("Summary snippet for #{r}") if @logger
|
54
54
|
"#{run_link(r)} started at #{time_formatted(r.context.start_time)}"
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
def run_link r
|
58
58
|
"<a class=\"smallgreytext\" href=\"#{run_url(r)}\">Run #{r.id}</a>"
|
59
59
|
end
|
60
60
|
#will render a hash in a table of key||value rows
|
61
61
|
def context_table context
|
62
|
-
ret="
|
63
|
-
context.
|
64
|
-
ret
|
62
|
+
ret=""
|
63
|
+
if context.is_a?(Hash)
|
64
|
+
ret="<p>"
|
65
|
+
ret<<"Run configured from #{context[:config_file]}<br/>" if context[:config_file]
|
66
|
+
ret<<"Started at #{time_formatted(context[:start_time])}<br/>"
|
67
|
+
ret<<"Ended at #{time_formatted(context[:end_time])}<br/>"
|
68
|
+
ret<<"Total duration #{context[:end_time]-context[:start_time]} seconds</p>"
|
65
69
|
end
|
66
|
-
ret
|
70
|
+
return ret
|
67
71
|
end
|
68
|
-
|
72
|
+
|
69
73
|
#returns the pagination HTML for runs
|
70
74
|
def run_page_link page_number,page_total
|
71
75
|
ret=""
|
@@ -86,23 +90,23 @@ module Rutema
|
|
86
90
|
end
|
87
91
|
return ret
|
88
92
|
end
|
89
|
-
|
93
|
+
|
90
94
|
#Gives the HTML to use for the status column of a scenario list
|
91
95
|
def scenario_status r
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
+
img_src=IMG_SCE_WARN
|
97
|
+
img_src=IMG_SCE_OK if "success"==r.status
|
98
|
+
img_src=IMG_SCE_ERROR if "error"==r.status
|
99
|
+
"<img src=\"#{img_src}\" align=\"center\"/>"
|
96
100
|
end
|
97
|
-
|
101
|
+
|
98
102
|
end
|
99
|
-
|
103
|
+
|
100
104
|
#Sets the values we need for public and view directories
|
101
105
|
def self.ramaze_settings
|
102
|
-
|
103
|
-
|
106
|
+
Ramaze::Global.public_root = File.expand_path(File.join(File.dirname(__FILE__),"public"))
|
107
|
+
Ramaze::Global.view_root = File.expand_path(File.join(File.dirname(__FILE__),"view"))
|
104
108
|
end
|
105
|
-
|
109
|
+
|
106
110
|
class MainController < Ramaze::Controller
|
107
111
|
include ViewUtilities
|
108
112
|
map '/'
|
@@ -110,7 +114,7 @@ module Rutema
|
|
110
114
|
layout :layout
|
111
115
|
#The number of items to show in lists
|
112
116
|
PAGE_SIZE=10
|
113
|
-
|
117
|
+
|
114
118
|
def index
|
115
119
|
@title="Rutema"
|
116
120
|
@panel_content=panel_runs
|
@@ -125,7 +129,7 @@ module Rutema
|
|
125
129
|
dt=[]
|
126
130
|
total_pages=(Rutema::Model::Run.count/PAGE_SIZE)+1
|
127
131
|
page_number=validated_page_number(page,total_pages)
|
128
|
-
|
132
|
+
|
129
133
|
runs=Rutema::Model::Run.find_on_page(page_number,PAGE_SIZE)
|
130
134
|
runs.each do |r|
|
131
135
|
dt<<[status_icon(r.status),run_summary(r)]
|
@@ -149,7 +153,7 @@ module Rutema
|
|
149
153
|
runs
|
150
154
|
end
|
151
155
|
end
|
152
|
-
|
156
|
+
|
153
157
|
#Displays a paginated list of scenarios
|
154
158
|
def scenarios page=0
|
155
159
|
@title="All scenarios"
|
@@ -176,9 +180,9 @@ module Rutema
|
|
176
180
|
nm=sc.name
|
177
181
|
#sort the run ids
|
178
182
|
runs[nm]=runs[nm].sort.reverse[0..4]
|
179
|
-
dt<<["<a href=\"/scenario/#{nm}\">#{nm}</a> : ",sc.title,runs[nm].map{|r| " <a href=\"/run/#{r}\">#{r}</a>"}.join(" ")]
|
183
|
+
dt<<["<a href=\"/scenario/#{nm}\">#{nm}</a> : ",sc.title,runs[nm].map{|r| " <a href=\"/run/#{r}\">#{r}</a>"}.join(" "),"#{failure_rate(sc.name)}%"]
|
180
184
|
end
|
181
|
-
@content<<Ruport::Data::Table.new(:data=>dt,:column_names=>["name","title","last 5 runs"]).to_html
|
185
|
+
@content<<Ruport::Data::Table.new(:data=>dt,:column_names=>["name","title","last 5 runs","failure rate"]).to_html
|
182
186
|
@content<<"<br/>"
|
183
187
|
@content<<scenario_page_link(page_number,total_pages)
|
184
188
|
end
|
@@ -195,10 +199,10 @@ module Rutema
|
|
195
199
|
return scenarios
|
196
200
|
end
|
197
201
|
end
|
198
|
-
|
202
|
+
|
199
203
|
def error
|
200
204
|
end
|
201
|
-
|
205
|
+
|
202
206
|
def settings
|
203
207
|
if request.post?
|
204
208
|
end
|
@@ -219,7 +223,7 @@ module Rutema
|
|
219
223
|
end
|
220
224
|
return page_number
|
221
225
|
end
|
222
|
-
|
226
|
+
|
223
227
|
#Renders the summary of all runs for a single scenario
|
224
228
|
def scenario_by_name scenario_id
|
225
229
|
ret=""
|
@@ -227,7 +231,7 @@ module Rutema
|
|
227
231
|
@content_title="Scenario #{scenario_id} runs"
|
228
232
|
begin
|
229
233
|
table=Rutema::Model::Scenario.report_table(:all,:conditions=>["name = :spec_name",{:spec_name=>scenario_id}],
|
230
|
-
|
234
|
+
:order=>"run_id DESC")
|
231
235
|
if table.empty?
|
232
236
|
ret="<p>no results for the given name</p>"
|
233
237
|
else
|
@@ -275,7 +279,7 @@ module Rutema
|
|
275
279
|
end
|
276
280
|
return ret
|
277
281
|
end
|
278
|
-
|
282
|
+
|
279
283
|
#Renders the information for a single run providing the context and a list of the scenarios
|
280
284
|
def single_run run_id
|
281
285
|
ret=""
|
@@ -304,7 +308,7 @@ module Rutema
|
|
304
308
|
end
|
305
309
|
return ret
|
306
310
|
end
|
307
|
-
|
311
|
+
|
308
312
|
def panel_runs
|
309
313
|
ret=""
|
310
314
|
Rutema::Model::Run.find(:all,:limit=>10,:order=>"id DESC").each do |r|
|
@@ -312,7 +316,65 @@ module Rutema
|
|
312
316
|
end
|
313
317
|
return ret
|
314
318
|
end
|
315
|
-
|
319
|
+
|
320
|
+
def failure_rate scenario_name
|
321
|
+
scenarios=Rutema::Model::Scenario.find(:all,:conditions=>["name = :spec_name",{:spec_name=>scenario_name}])
|
322
|
+
failures=0
|
323
|
+
scenarios.each{|sc| failures+=1 unless sc.status=="success" }
|
324
|
+
return ((failures.to_f/scenarios.size)*100).round
|
325
|
+
end
|
316
326
|
end
|
327
|
+
|
328
|
+
# class StatisticsController < Ramaze::Controller
|
329
|
+
# include ViewUtilities
|
330
|
+
# map '/statistics'
|
331
|
+
# engine :Erubis
|
332
|
+
# layout :layout
|
333
|
+
# deny_layout :graph
|
334
|
+
# view_root(File.expand_path(File.join(File.dirname(__FILE__),"view")))
|
335
|
+
# def index
|
336
|
+
#
|
337
|
+
# end
|
338
|
+
# def config_report configuration
|
339
|
+
# @content="<img src=\"/statistics/graph/#{configuration}\""
|
340
|
+
# end
|
341
|
+
# def graph configuration
|
342
|
+
# response.header['Content-type'] = "image/jpg"
|
343
|
+
# successful=[]
|
344
|
+
# failed=[]
|
345
|
+
# labels=Hash.new
|
346
|
+
# if configuration
|
347
|
+
# #find all runs beloging to this configuration
|
348
|
+
# runs=Rutema::Model::Run.find(:all)
|
349
|
+
# runs=runs.select{|r| r.context[:config_file]==configuration if r.context.is_a?(Hash)}
|
350
|
+
# #now extract the data
|
351
|
+
#
|
352
|
+
# counter=0
|
353
|
+
# runs.each do |r|
|
354
|
+
# fails=r.number_of_failed
|
355
|
+
# successful<<r.scenarios.size-fails
|
356
|
+
# failed<<fails
|
357
|
+
# labels[counter]="R#{r.id}"
|
358
|
+
# counter+=1
|
359
|
+
# end
|
360
|
+
# end
|
361
|
+
# require 'rubygems'
|
362
|
+
# require 'gruff'
|
363
|
+
#
|
364
|
+
# graph=Gruff::StackedBar.new(640)
|
365
|
+
#
|
366
|
+
# graph.data("successful",successful)
|
367
|
+
# graph.data("failed",failed)
|
368
|
+
# graph.labels=labels
|
369
|
+
# return graph.to_blob("JPG")
|
370
|
+
# end
|
371
|
+
#
|
372
|
+
# private
|
373
|
+
# #extract all the configuration names
|
374
|
+
# def configurations
|
375
|
+
# runs=Rutema::Model::Run.find(:all)
|
376
|
+
# return runs.map{|r| r.context[:config_file] if r.context.is_a?(Hash)}.compact.uniq
|
377
|
+
# end
|
378
|
+
# end
|
317
379
|
end
|
318
380
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rutemaweb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vassilis Rizopoulos
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-05 00:00:00 +01:00
|
13
13
|
default_executable: rutemaweb
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ">="
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.8.
|
93
|
+
version: 1.8.2
|
94
94
|
version:
|
95
95
|
description: "== DESCRIPTION: rutemaweb is the web frontend for rutema. It can be used as a viewer for database files created with the ActiveRecord reporter. == FEATURES/PROBLEMS: == SYNOPSIS: rutemaweb [results.db] and browse to http://localhost:7000 for the glorious view == REQUIREMENTS: * patir (http://patir.rubyforge.org) * activerecord (http://ar.rubyonrails.com/) * sqlite3 (http://rubyforge.org/projects/sqlite-ruby/) * ramaze (http://www.ramaze.net/) * ruport (http://rubyreports.org/) * acts_as_reportable * erubis"
|
96
96
|
email: riva@braveworld.net
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
requirements: []
|
154
154
|
|
155
155
|
rubyforge_project: patir
|
156
|
-
rubygems_version: 1.3.
|
156
|
+
rubygems_version: 1.3.1
|
157
157
|
signing_key:
|
158
158
|
specification_version: 2
|
159
159
|
summary: rutemaweb is the web frontend for rutema
|