rutema_web 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gemtest ADDED
File without changes
data/History.txt CHANGED
@@ -1,3 +1,5 @@
1
+ ===1.0.5 / 2011-04-01
2
+ * Updated to use the latest rutema (1.2.0) and sinatra releases
1
3
  === 1.0.4 / 2010-04-23
2
4
  * Fixed manifest missing entry for the flot lib
3
5
  * Fixed sequence of data in flot diagrams (was reversed)
data/Manifest.txt CHANGED
@@ -1,12 +1,10 @@
1
+ bin/rutema_web
1
2
  COPYING.txt
2
3
  History.txt
3
- Manifest.txt
4
- README.txt
5
- Rakefile
6
- bin/rutema_web
4
+ lib/rutema_web/activerecord/model.rb
5
+ lib/rutema_web/activerecord/ruport_formatter.rb
7
6
  lib/rutema_web/gems.rb
8
7
  lib/rutema_web/main.rb
9
- lib/rutema_web/model.rb
10
8
  lib/rutema_web/public/css/style.css
11
9
  lib/rutema_web/public/images/bg_menu.gif
12
10
  lib/rutema_web/public/images/bg_submenu.gif
@@ -24,9 +22,13 @@ lib/rutema_web/public/js/graph.js
24
22
  lib/rutema_web/public/js/jquery-1.3.2.min.js
25
23
  lib/rutema_web/public/js/jquery.flot.min.js
26
24
  lib/rutema_web/public/js/jquery.flot.stack.min.js
27
- lib/rutema_web/ruport_formatter.rb
28
25
  lib/rutema_web/sinatra.rb
29
26
  lib/rutema_web/views/flot.erb
30
27
  lib/rutema_web/views/main.erb
31
28
  lib/rutema_web/views/timeline.erb
32
- test/test_model.rb
29
+ Manifest.txt
30
+ Rakefile
31
+ README.md
32
+ README.txt
33
+ test/config.yaml
34
+ test/test_model.rb
data/README.md ADDED
@@ -0,0 +1,95 @@
1
+ rutema_web [http://patir.rubyforge.org/rutema](http://patir.rubyforge.org/rutema)
2
+
3
+ ##DESCRIPTION:
4
+ rutema_web is the web frontend for rutema.
5
+
6
+ It can be used as a viewer for database files created with the rutema ActiveRecord reporter.
7
+ It also provides you with some basic statistics about the tests in your database in the form of
8
+ diagrams of debatable aesthetics but undoubtable value!
9
+
10
+ ##SYNOPSIS:
11
+ rutema_web config.yaml and browse to http://localhost:7000 for the glorious view
12
+
13
+ Here is a sample of the configuration YAML:
14
+ <pre>
15
+ ---
16
+ :db:
17
+ :adapter: sqlite3
18
+ :database: rutema_test.db
19
+ :settings:
20
+ :page_size: 10
21
+ :last_n_runs: 20
22
+ :port: 7000
23
+ :show_setup_teardown: true
24
+ </pre>
25
+ The :db: section should be the activerecord adapter configuration. The :settings: section controls the behaviour of the web app.
26
+
27
+ ##REQUIREMENTS:
28
+ * rutema (http://patir.rubyforge.org/rutema)
29
+ * sinatra (http://www.sinatrarb.com/)
30
+ * ruport (http://rubyreports.org/)
31
+
32
+ ##INSTALL:
33
+ * sudo gem install rutema_web
34
+
35
+ ##LICENSE:
36
+ (The Ruby License)
37
+
38
+ rutema is copyright (c) 2007 - 2010 Vassilis Rizopoulos
39
+
40
+ You can redistribute it and/or modify it under either the terms of the GPL
41
+ (see COPYING.txt file), or the conditions below:
42
+
43
+ 1. You may make and give away verbatim copies of the source form of the
44
+ software without restriction, provided that you duplicate all of the
45
+ original copyright notices and associated disclaimers.
46
+
47
+ 2. You may modify your copy of the software in any way, provided that
48
+ you do at least ONE of the following:
49
+
50
+ a) place your modifications in the Public Domain or otherwise
51
+ make them Freely Available, such as by posting said
52
+ modifications to Usenet or an equivalent medium, or by allowing
53
+ the author to include your modifications in the software.
54
+
55
+ b) use the modified software only within your corporation or
56
+ organization.
57
+
58
+ c) rename any non-standard executables so the names do not conflict
59
+ with standard executables, which must also be provided.
60
+
61
+ d) make other distribution arrangements with the author.
62
+
63
+ 3. You may distribute the software in object code or executable
64
+ form, provided that you do at least ONE of the following:
65
+
66
+ a) distribute the executables and library files of the software,
67
+ together with instructions (in the manual page or equivalent)
68
+ on where to get the original distribution.
69
+
70
+ b) accompany the distribution with the machine-readable source of
71
+ the software.
72
+
73
+ c) give non-standard executables non-standard names, with
74
+ instructions on where to get the original software distribution.
75
+
76
+ d) make other distribution arrangements with the author.
77
+
78
+ 4. You may modify and include the part of the software into any other
79
+ software (possibly commercial). But some files in the distribution
80
+ are not written by the author, so that they are not under this terms.
81
+
82
+ They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
83
+ files under the ./missing directory. See each file for the copying
84
+ condition.
85
+
86
+ 5. The scripts and library files supplied as input to or produced as
87
+ output from the software do not automatically fall under the
88
+ copyright of the software, but belong to whomever generated them,
89
+ and may be sold commercially, and may be aggregated with this
90
+ software.
91
+
92
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
93
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
94
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95
+ PURPOSE.
data/README.txt CHANGED
@@ -7,11 +7,22 @@ It can be used as a viewer for database files created with the rutema ActiveReco
7
7
  It also provides you with some basic statistics about the tests in your database in the form of
8
8
  diagrams of debatable aesthetics but undoubtable value!
9
9
 
10
- == FEATURES/PROBLEMS:
11
-
12
10
  == SYNOPSIS:
13
11
  rutema_web config.yaml and browse to http://localhost:7000 for the glorious view
14
12
 
13
+ Here is a sample of the configuration YAML:
14
+ ---
15
+ :db:
16
+ :adapter: sqlite3
17
+ :database: rutema_test.db
18
+ :settings:
19
+ :page_size: 10
20
+ :last_n_runs: 20
21
+ :port: 7000
22
+ :show_setup_teardown: true
23
+
24
+ The :db: section should be the activerecord adapter configuration. The :settings: section controls the behaviour of the web app.
25
+
15
26
  == REQUIREMENTS:
16
27
  * rutema (http://patir.rubyforge.org/rutema)
17
28
  * sinatra (http://www.sinatrarb.com/)
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  # Copyright (c) 2008 Vassilis Rizopoulos. All rights reserved.
2
2
  # -*- ruby -*-
3
3
  $:.unshift File.join(File.dirname(__FILE__),"lib")
4
- require 'rutema_web/main'
5
4
  require 'rubygems'
5
+ require 'rutema_web/main'
6
6
  require 'hoe'
7
7
 
8
8
  Hoe.spec('rutema_web') do |p|
@@ -12,11 +12,10 @@ Hoe.spec('rutema_web') do |p|
12
12
  p.email = "riva@braveworld.net"
13
13
  p.summary = 'rutema_web is the web frontend for rutema'
14
14
  p.description = p.paragraphs_of('README.txt', 1..5).join("\n\n")
15
- p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
15
+ p.url = "http://patir.rubyforge.org/rutema"
16
16
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
17
- p.extra_deps<<['rutema',"=1.0.9"]
18
- p.extra_deps<<['sinatra','=1.0.0']
17
+ p.extra_deps<<['rutema',"=1.2.0"]
18
+ p.extra_deps<<['sinatra','=1.2.1']
19
19
  p.extra_deps<<['ruport','>=1.6.1']
20
- p.spec_extras={:executables=>["rutema_web"],
21
- :default_executable=>"rutema_web"}
20
+ p.spec_extras={:executables=>["rutema_web"],:default_executable=>"rutema_web"}
22
21
  end
data/bin/rutema_web CHANGED
@@ -1,5 +1,6 @@
1
1
  # Copyright (c) 2007 Vassilis Rizopoulos. All rights reserved.
2
2
  #this locks on the versions we need
3
+ require 'rubygems'
3
4
  require 'rutema_web/gems'
4
5
  require 'rutema_web/main'
5
6
 
@@ -1,10 +1,10 @@
1
1
  # Copyright (c) 2008 Vassilis Rizopoulos. All rights reserved.
2
2
  $:.unshift File.join(File.dirname(__FILE__),"..")
3
- require 'rutema/model'
3
+ require 'rutema/models/activerecord'
4
4
  module Rutema
5
- module Model
6
- #Extensions of Rutema::Model::Run to accomodate specific view requirements for rutema_web
7
- class Run <ActiveRecord::Base
5
+ module ActiveRecord
6
+ #Extensions of Rutema::ActiveRecord::Run to accomodate specific view requirements for rutema_web
7
+ class Run <::ActiveRecord::Base
8
8
  # The view wants to display runs grouped into pages,
9
9
  # where each page shows page_size runs at a time.
10
10
  # This method returns the runs on page page_num (starting
@@ -35,16 +35,16 @@ module Rutema
35
35
  #number of unsuccessful scenarios (does not count setup or teardown scripts)
36
36
  def number_of_failed
37
37
  #self.scenarios.select{|sc| !sc.success? && !sc.not_executed? && sc.is_test? }.size
38
- Rutema::Model::Scenario.count(:conditions=>"run_id=#{self.id} AND status = 'error' AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'")
38
+ Rutema::ActiveRecord::Scenario.count(:conditions=>"run_id=#{self.id} AND status = 'error' AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'")
39
39
  end
40
40
  #number of scenarios that did not run (does not count setup or teardown scripts)
41
41
  def number_of_not_executed
42
42
  #self.scenarios.select{|sc| sc.not_executed? && sc.is_test? }.size
43
- Rutema::Model::Scenario.count(:conditions=>"run_id=#{self.id} AND status = 'not_executed' AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'")
43
+ Rutema::ActiveRecord::Scenario.count(:conditions=>"run_id=#{self.id} AND status = 'not_executed' AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'")
44
44
  end
45
45
  #returns the number of actual tests (so, don't take into account setup or teardown tests)
46
46
  def number_of_tests
47
- Rutema::Model::Scenario.count(:conditions=>"run_id=#{self.id} AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'")
47
+ Rutema::ActiveRecord::Scenario.count(:conditions=>"run_id=#{self.id} AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'")
48
48
  end
49
49
  #the number of the configuration file used to run the test
50
50
  def config_file
@@ -53,8 +53,8 @@ module Rutema
53
53
  end
54
54
 
55
55
  end
56
- #Extensions of Rutema::Model::Scenario to accomodate specific view requirements for rutema_web
57
- class Scenario <ActiveRecord::Base
56
+ #Extensions of Rutema::ActiveRecord::Scenario to accomodate specific view requirements for rutema_web
57
+ class Scenario <::ActiveRecord::Base
58
58
  # The view wants to display scenarios grouped into pages,
59
59
  # where each page shows page_size scenarios at a time.
60
60
  # This method returns the scenarios grouped by name on page page_num (starting
@@ -83,7 +83,3 @@ module Rutema
83
83
  end
84
84
  end
85
85
  end
86
-
87
-
88
-
89
-
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
- gem 'sinatra','=1.0.0'
3
- gem 'rutema',"=1.0.9"
4
- gem 'ruport','>=1.6.1'
1
+ gem 'sinatra','=1.2.1'
2
+ gem 'rutema',"=1.2.0"
3
+ gem 'json','=1.5.1'
@@ -1,15 +1,15 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..")
2
- require 'rutema_web/sinatra'
3
2
  require 'optparse'
4
- require 'rutema/reporters/activerecord'
3
+ require 'patir/base'
4
+ require 'rutema_web/activerecord/model'
5
+ require 'rutema_web/sinatra'
5
6
  #This is the web frontend for Rutema databases.
6
7
  module RutemaWeb
7
- extend Rutema::ActiveRecordConnections
8
8
  #This module defines the version numbers for the library
9
9
  module Version
10
10
  MAJOR=1
11
11
  MINOR=0
12
- TINY=4
12
+ TINY=5
13
13
  STRING=[ MAJOR, MINOR, TINY ].join( "." )
14
14
  end
15
15
  #Starts App
@@ -19,7 +19,7 @@ module RutemaWeb
19
19
  cfg_file=File.expand_path(cfg_file)
20
20
  configuration=YAML.load_file(cfg_file)
21
21
  if (configuration[:db])
22
- self.connect_to_active_record(configuration[:db],logger)
22
+ Rutema::ActiveRecord.connect(configuration[:db],logger)
23
23
  RutemaWeb::UI::SinatraApp.define_settings(configuration[:settings])
24
24
  RutemaWeb::UI::SinatraApp.run!
25
25
  else
@@ -45,8 +45,5 @@ module RutemaWeb
45
45
  end
46
46
  end
47
47
  end
48
-
49
48
  end
50
49
 
51
-
52
-
@@ -2,11 +2,9 @@
2
2
  $:.unshift File.join(File.dirname(__FILE__),"..")
3
3
  require 'sinatra/base'
4
4
  require 'erb'
5
- require 'patir/configuration'
6
- require 'patir/command'
7
5
  require 'patir/base'
8
- require 'rutema_web/model'
9
- require 'rutema_web/ruport_formatter'
6
+ require 'rutema_web/activerecord/model'
7
+ require 'rutema_web/activerecord/ruport_formatter'
10
8
  require 'json'
11
9
 
12
10
  module RutemaWeb
@@ -116,7 +114,7 @@ module RutemaWeb
116
114
  private
117
115
  #extract all the configuration names
118
116
  def configurations
119
- runs=Rutema::Model::Run.find(:all)
117
+ runs=Rutema::ActiveRecord::Run.find(:all)
120
118
  return runs.map{|r| r.context[:config_file] if r.context.is_a?(Hash)}.compact.uniq
121
119
  end
122
120
  def panel_configurations type,action=nil
@@ -322,7 +320,7 @@ module RutemaWeb
322
320
  end
323
321
  #finds all the runs belonging to a specific configuration
324
322
  def all_runs_in_configuration configuration
325
- runs=Rutema::Model::Run.find(:all,:order=>"id ASC")
323
+ runs=Rutema::ActiveRecord::Run.find(:all,:order=>"id ASC")
326
324
  #find all runs beloging to this configuration
327
325
  runs.select{|r| r.context[:config_file]==configuration if r.context.is_a?(Hash)} if configuration
328
326
  end
@@ -338,10 +336,10 @@ module RutemaWeb
338
336
  page_setup "All runs",nil,"All runs"
339
337
 
340
338
  dt=[]
341
- total_pages=(Rutema::Model::Run.count/settings.page_size)+1
339
+ total_pages=(Rutema::ActiveRecord::Run.count/settings.page_size)+1
342
340
  page_number=validated_page_number(page,total_pages)
343
341
 
344
- runs=Rutema::Model::Run.find_on_page(page_number,settings.page_size)
342
+ runs=Rutema::ActiveRecord::Run.find_on_page(page_number,settings.page_size)
345
343
  runs.each do |r|
346
344
  dt<<[status_icon(r.status),run_summary(r),r.config_file]
347
345
  end
@@ -356,7 +354,7 @@ module RutemaWeb
356
354
  #find which runs contain each scenario with the same name
357
355
  #Ramaze::Log.debug("Getting the runs for each scenario")
358
356
  conditions="name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'"
359
- Rutema::Model::Scenario.find(:all, :conditions=>conditions).each do |sc|
357
+ Rutema::ActiveRecord::Scenario.find(:all, :conditions=>conditions).each do |sc|
360
358
  nm=sc.name
361
359
  runs[nm]||=[]
362
360
  runs[nm]<<sc.run.id
@@ -365,7 +363,7 @@ module RutemaWeb
365
363
  total_pages=(runs.size / settings.page_size)+1
366
364
  page_number=validated_page_number(page,total_pages)
367
365
  #Ramaze::Log.debug("Getting scenarios for page #{page_number}")
368
- scens=Rutema::Model::Scenario.find_on_page(page_number,settings.page_size,conditions)
366
+ scens=Rutema::ActiveRecord::Scenario.find_on_page(page_number,settings.page_size,conditions)
369
367
  #and now build the table data
370
368
  dt=Array.new
371
369
  scens.each do |sc|
@@ -395,7 +393,7 @@ module RutemaWeb
395
393
  ret=""
396
394
  page_setup "Runs for #{scenario_id}",nil,"Scenario #{scenario_id} runs"
397
395
  begin
398
- table=Rutema::Model::Scenario.report_table(:all,:conditions=>["name = :spec_name",{:spec_name=>scenario_id}],
396
+ table=Rutema::ActiveRecord::Scenario.report_table(:all,:conditions=>["name = :spec_name",{:spec_name=>scenario_id}],
399
397
  :order=>"run_id DESC")
400
398
  if table.empty?
401
399
  ret="<p>no results for the given name</p>"
@@ -422,9 +420,9 @@ module RutemaWeb
422
420
  #giving a detailed list of the steps, with status and output
423
421
  def scenario_in_a_run scenario_id
424
422
  begin
425
- scenario=Rutema::Model::Scenario.find(scenario_id)
423
+ scenario=Rutema::ActiveRecord::Scenario.find(scenario_id)
426
424
  page_setup "Summary for #{scenario.name} in run #{scenario.run_id}",panel_runs,"Summary for #{scenario.name} in run #{scenario.run_id}"
427
- table=Rutema::Model::Step.report_table(:all,
425
+ table=Rutema::ActiveRecord::Step.report_table(:all,
428
426
  :conditions=>["scenario_id = :scenario_id",{:scenario_id=>scenario_id}],
429
427
  :order=>"number ASC")
430
428
  if table.empty?
@@ -447,7 +445,7 @@ module RutemaWeb
447
445
  def single_run run_id
448
446
  ret=""
449
447
  begin
450
- run=Rutema::Model::Run.find(run_id)
448
+ run=Rutema::ActiveRecord::Run.find(run_id)
451
449
  rescue
452
450
  return "Could not find #{run_id}"
453
451
  end
@@ -455,7 +453,7 @@ module RutemaWeb
455
453
  ret<<context_table(run.context)
456
454
  end
457
455
  conditions="run_id = :run_id AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'"
458
- table=Rutema::Model::Scenario.report_table(:all,
456
+ table=Rutema::ActiveRecord::Scenario.report_table(:all,
459
457
  :conditions=>[conditions,{:run_id=>run_id}],:except=>["run_id"],
460
458
  :order=>"start_time ASC")
461
459
  if table.empty?
@@ -474,14 +472,14 @@ module RutemaWeb
474
472
 
475
473
  def panel_runs
476
474
  ret=""
477
- Rutema::Model::Run.find(:all,:limit=>10,:order=>"id DESC").each do |r|
475
+ Rutema::ActiveRecord::Run.find(:all,:limit=>10,:order=>"id DESC").each do |r|
478
476
  ret<<"#{status_icon(r.status)} #{run_link(r)}<br/>"
479
477
  end
480
478
  return ret
481
479
  end
482
480
 
483
481
  def failure_rate scenario_name
484
- scenarios=Rutema::Model::Scenario.find(:all,:conditions=>["name = :spec_name",{:spec_name=>scenario_name}])
482
+ scenarios=Rutema::ActiveRecord::Scenario.find(:all,:conditions=>["name = :spec_name",{:spec_name=>scenario_name}])
485
483
  failures=0
486
484
  scenarios.each{|sc| failures+=1 unless sc.status=="success" }
487
485
  return ((failures.to_f/scenarios.size)*100).round
data/test/config.yaml ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ :db:
3
+ :adapter: sqlite3
4
+ :database: rutema_test.db
5
+ :settings:
6
+ :page_size: 10
7
+ :last_n_runs: 20
8
+ :port: 7000
9
+ :show_setup_teardown: true
data/test/test_model.rb CHANGED
@@ -1,27 +1,27 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),"..")
1
2
  require 'test/unit'
2
3
  require 'ostruct'
3
- require 'rutema_web/ramaze_controller'
4
4
  require 'rubygems'
5
5
  require 'mocha'
6
+ require 'lib/rutema_web/activerecord/model'
6
7
 
7
8
  class TestModel <Test::Unit::TestCase
8
- ActiveRecord::Base.establish_connection(:adapter => "sqlite3",:database =>":memory:")
9
- Rutema::Model::Schema.up
9
+ ::ActiveRecord::Base.establish_connection(:adapter => "sqlite3",:database =>":memory:")
10
+ Rutema::ActiveRecord::Schema.up
10
11
  def setup
11
- @stp=Rutema::Model::Scenario.new
12
- @stp.name="test_setup"
13
- @trd=Rutema::Model::Scenario.new
14
- @trd.name="test_teardown"
15
- @tst=Rutema::Model::Scenario.new
16
- @tst.name="test"
17
- @r=Rutema::Model::Run.new
12
+ @stp=Rutema::ActiveRecord::Scenario.new(:name=>"TC000_setup",:attended=>false,:status=>"success",:start_time=>Time.now)
13
+ @stp.steps<<Rutema::ActiveRecord::Step.new(:name=>"echo",:number=>1,:status=>"success",:output=>"testing is nice",:error=>"",:duration=>1)
14
+ @trd=Rutema::ActiveRecord::Scenario.new(:name=>"TC000_teardown",:attended=>false,:status=>"success",:start_time=>Time.now)
15
+ @trd.steps<<Rutema::ActiveRecord::Step.new(:name=>"echo",:number=>1,:status=>"success",:output=>"testing is nice",:error=>"",:duration=>1)
16
+ @tst=Rutema::ActiveRecord::Scenario.new(:name=>"TC000",:attended=>false,:status=>"success",:start_time=>Time.now)
17
+ @trd.steps<<Rutema::ActiveRecord::Step.new(:name=>"echo",:number=>1,:status=>"success",:output=>"testing is nice",:error=>"",:duration=>1)
18
+ @r=Rutema::ActiveRecord::Run.new
18
19
  @r.scenarios=[@stp,@tst,@trd]
20
+ @r.save
19
21
  end
20
22
  def test_status
21
23
  assert_equal(:success,@r.status)
22
- t1=Rutema::Model::Scenario.new
23
- t1.name="failed"
24
- t1.stubs(:status).returns("error")
24
+ t1=Rutema::ActiveRecord::Scenario.new(:name=>"failed",:attended=>false,:status=>"error",:start_time=>Time.now)
25
25
  @r.scenarios<<t1
26
26
  assert_equal(:error,@r.status)
27
27
  end
@@ -34,15 +34,19 @@ class TestModel <Test::Unit::TestCase
34
34
  assert_equal(1, @r.number_of_tests)
35
35
  end
36
36
  def test_number_of_failed
37
- t1=Rutema::Model::Scenario.new
38
- t1.name="failed"
39
- t1.stubs(:status).returns("error")
40
- t2=Rutema::Model::Scenario.new
41
- t2.name="not executed"
42
- t2.stubs(:status).returns("not_executed")
37
+ t1=Rutema::ActiveRecord::Scenario.new(:name=>"failed",:attended=>false,:status=>"error",:start_time=>Time.now)
38
+ t2=Rutema::ActiveRecord::Scenario.new(:name=>"not executed",:attended=>false,:status=>"not_executed",:start_time=>Time.now)
43
39
  @tst.stubs(:status).returns("success")
44
40
  @r.scenarios<<t1
45
41
  @r.scenarios<<t2
46
- assert_equal(2,@r.number_of_failed)
42
+ assert_equal(1,@r.number_of_failed)
43
+ end
44
+ def test_number_of_not_executed
45
+ t1=Rutema::ActiveRecord::Scenario.new(:name=>"failed",:attended=>false,:status=>"error",:start_time=>Time.now)
46
+ t2=Rutema::ActiveRecord::Scenario.new(:name=>"not executed",:attended=>false,:status=>"not_executed",:start_time=>Time.now)
47
+ @tst.stubs(:status).returns("success")
48
+ @r.scenarios<<t1
49
+ @r.scenarios<<t2
50
+ assert_equal(1,@r.number_of_not_executed)
47
51
  end
48
52
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rutema_web
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 29
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 4
9
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - Vassilis Rizopoulos
@@ -14,44 +15,50 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-23 00:00:00 +03:00
18
+ date: 2011-04-01 00:00:00 +03:00
18
19
  default_executable: rutema_web
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rutema
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - "="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 31
27
30
  segments:
28
31
  - 1
32
+ - 2
29
33
  - 0
30
- - 9
31
- version: 1.0.9
34
+ version: 1.2.0
32
35
  type: :runtime
33
36
  version_requirements: *id001
34
37
  - !ruby/object:Gem::Dependency
35
38
  name: sinatra
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - "="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 29
41
46
  segments:
42
47
  - 1
43
- - 0
44
- - 0
45
- version: 1.0.0
48
+ - 2
49
+ - 1
50
+ version: 1.2.1
46
51
  type: :runtime
47
52
  version_requirements: *id002
48
53
  - !ruby/object:Gem::Dependency
49
54
  name: ruport
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 13
55
62
  segments:
56
63
  - 1
57
64
  - 6
@@ -60,33 +67,21 @@ dependencies:
60
67
  type: :runtime
61
68
  version_requirements: *id003
62
69
  - !ruby/object:Gem::Dependency
63
- name: rubyforge
70
+ name: hoe
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ">="
68
76
  - !ruby/object:Gem::Version
77
+ hash: 47
69
78
  segments:
70
79
  - 2
71
- - 0
72
- - 4
73
- version: 2.0.4
74
- type: :development
75
- version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
77
- name: hoe
78
- prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- segments:
80
+ - 9
84
81
  - 2
85
- - 6
86
- - 0
87
- version: 2.6.0
82
+ version: 2.9.2
88
83
  type: :development
89
- version_requirements: *id005
84
+ version_requirements: *id004
90
85
  description: |-
91
86
  == DESCRIPTION:
92
87
  rutema_web is the web frontend for rutema.
@@ -95,15 +90,21 @@ description: |-
95
90
  It also provides you with some basic statistics about the tests in your database in the form of
96
91
  diagrams of debatable aesthetics but undoubtable value!
97
92
 
98
- == FEATURES/PROBLEMS:
99
-
100
93
  == SYNOPSIS:
101
94
  rutema_web config.yaml and browse to http://localhost:7000 for the glorious view
102
95
 
103
- == REQUIREMENTS:
104
- * rutema (http://patir.rubyforge.org/rutema)
105
- * sinatra (http://www.sinatrarb.com/)
106
- * ruport (http://rubyreports.org/)
96
+ Here is a sample of the configuration YAML:
97
+ ---
98
+ :db:
99
+ :adapter: sqlite3
100
+ :database: rutema_test.db
101
+ :settings:
102
+ :page_size: 10
103
+ :last_n_runs: 20
104
+ :port: 7000
105
+ :show_setup_teardown: true
106
+
107
+ The :db: section should be the activerecord adapter configuration. The :settings: section controls the behaviour of the web app.
107
108
  email: riva@braveworld.net
108
109
  executables:
109
110
  - rutema_web
@@ -115,15 +116,13 @@ extra_rdoc_files:
115
116
  - Manifest.txt
116
117
  - README.txt
117
118
  files:
119
+ - bin/rutema_web
118
120
  - COPYING.txt
119
121
  - History.txt
120
- - Manifest.txt
121
- - README.txt
122
- - Rakefile
123
- - bin/rutema_web
122
+ - lib/rutema_web/activerecord/model.rb
123
+ - lib/rutema_web/activerecord/ruport_formatter.rb
124
124
  - lib/rutema_web/gems.rb
125
125
  - lib/rutema_web/main.rb
126
- - lib/rutema_web/model.rb
127
126
  - lib/rutema_web/public/css/style.css
128
127
  - lib/rutema_web/public/images/bg_menu.gif
129
128
  - lib/rutema_web/public/images/bg_submenu.gif
@@ -141,14 +140,19 @@ files:
141
140
  - lib/rutema_web/public/js/jquery-1.3.2.min.js
142
141
  - lib/rutema_web/public/js/jquery.flot.min.js
143
142
  - lib/rutema_web/public/js/jquery.flot.stack.min.js
144
- - lib/rutema_web/ruport_formatter.rb
145
143
  - lib/rutema_web/sinatra.rb
146
144
  - lib/rutema_web/views/flot.erb
147
145
  - lib/rutema_web/views/main.erb
148
146
  - lib/rutema_web/views/timeline.erb
147
+ - Manifest.txt
148
+ - Rakefile
149
+ - README.md
150
+ - README.txt
151
+ - test/config.yaml
149
152
  - test/test_model.rb
153
+ - .gemtest
150
154
  has_rdoc: true
151
- homepage:
155
+ homepage: http://patir.rubyforge.org/rutema
152
156
  licenses: []
153
157
 
154
158
  post_install_message:
@@ -158,26 +162,29 @@ rdoc_options:
158
162
  require_paths:
159
163
  - lib
160
164
  required_ruby_version: !ruby/object:Gem::Requirement
165
+ none: false
161
166
  requirements:
162
167
  - - ">="
163
168
  - !ruby/object:Gem::Version
169
+ hash: 3
164
170
  segments:
165
171
  - 0
166
172
  version: "0"
167
173
  required_rubygems_version: !ruby/object:Gem::Requirement
174
+ none: false
168
175
  requirements:
169
176
  - - ">="
170
177
  - !ruby/object:Gem::Version
178
+ hash: 3
171
179
  segments:
172
180
  - 0
173
181
  version: "0"
174
182
  requirements: []
175
183
 
176
184
  rubyforge_project: patir
177
- rubygems_version: 1.3.6
185
+ rubygems_version: 1.5.0
178
186
  signing_key:
179
187
  specification_version: 3
180
188
  summary: rutema_web is the web frontend for rutema
181
189
  test_files:
182
190
  - test/test_model.rb
183
- - test/test_rutema_web.rb
@@ -1,107 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
- require 'test/unit'
3
- require 'ostruct'
4
- require 'rutema_web/ramaze_controller'
5
- require 'rubygems'
6
- require 'mocha'
7
-
8
- class TestRutemaWeb <Test::Unit::TestCase
9
- ActiveRecord::Base.establish_connection(:adapter => "sqlite3",:database =>":memory:")
10
-
11
- def test_loading
12
- controller=nil
13
- assert_nothing_raised() { controller = Rutema::UI::MainController.new }
14
- return controller
15
- end
16
- def test_run
17
- cntlr=test_loading
18
- r=mock()
19
- r.expects(:id).returns(5).times(2)
20
- r.stubs(:context).returns({:start_time=>Time.now,:config_file=>"test"})
21
- r.stubs(:config_file).returns("test")
22
- r.stubs(:status).returns(:success)
23
- t=mock()
24
- t.expects(:to_html).returns("mocked")
25
- Rutema::Model::Run.expects(:find).returns([r])
26
- Rutema::Model::Run.expects(:count).returns(1)
27
- Ruport::Data::Table.expects(:new).returns(t)
28
- #Check nothing is raised when calling run (with everything mocked)
29
- assert_nothing_raised(){ cntlr.run}
30
- end
31
-
32
- def test_runs
33
- cntlr=test_loading
34
- mock_12_runs
35
- #Check nothing is raised when calling run (with everything mocked)
36
- assert_nothing_raised(){ cntlr.runs}
37
- return cntlr
38
- end
39
- #unit tests for the pagination code of runs
40
- def test_pagination
41
- cntlr=test_loading
42
- mock_12_runs
43
- #Check nothing is raised when calling run (with everything mocked)
44
- assert_nothing_raised(){ cntlr.runs(1)}
45
- return cntlr
46
- end
47
- def test_page_number_to_large
48
- cntlr=test_loading
49
- mock_12_runs
50
- #Check nothing is raised when calling run with a page number greater than the available
51
- assert_nothing_raised(){ cntlr.runs(50)}
52
- end
53
- def test_page_number_negative
54
- cntlr=test_loading
55
- mock_12_runs
56
- #Check nothing is raised when calling run with a negative page number greater than the available
57
- assert_nothing_raised(){ cntlr.runs(-1)}
58
- end
59
- def test_page_number_bogus
60
- cntlr=test_loading
61
- mock_12_runs
62
- #Check nothing is raised when calling run with a page number that is not a number
63
- assert_nothing_raised(){ cntlr.runs("atttaaaaack!!")}
64
- end
65
-
66
- #unit tests for scenarios
67
- def test_scenarios
68
- ctlr=test_loading
69
- mock_12_scenarios
70
- Rutema::Model::Run.expects(:find).returns("")
71
- assert_nothing_raised() { ctlr.scenarios }
72
- end
73
-
74
- def test_scenario_wrong_arguments
75
- ctlr=test_loading
76
- assert_raise(ArgumentError) { ctlr.scenario("bla","blu") }
77
- end
78
- private
79
- def mock_12_runs
80
- t=mock()
81
- t.expects(:to_html).returns("mocked")
82
- Ruport::Data::Table.expects(:new).returns(t)
83
- runs=[mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock()]
84
- runs.each do |r|
85
- r.stubs(:id).returns(5)
86
- r.stubs(:context).returns({:start_time=>Time.now,:config_file=>"test"})
87
- r.stubs(:status).returns(:success)
88
- r.stubs(:config_file).returns("test")
89
- end
90
- Rutema::Model::Run.expects(:find).returns(runs)
91
- Rutema::Model::Run.expects(:count).returns(12)
92
- end
93
-
94
- def mock_12_scenarios
95
- t=mock()
96
- t.expects(:to_html).returns("mocked")
97
- Ruport::Data::Table.expects(:new).returns(t)
98
- scenarios=[mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock(),mock()]
99
- scenarios.each do |sc|
100
- sc.stubs(:name).returns(scenarios.index(sc).to_s)
101
- sc.stubs(:status).returns(:success)
102
- sc.expects(:title).returns(scenarios.index(sc).to_s)
103
- sc.expects(:run).returns(scenarios.index(sc))
104
- end
105
- Rutema::Model::Scenario.stubs(:find).returns(scenarios)
106
- end
107
- end