gondola 1.2.5 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/Gemfile.lock +6 -6
- data/README.markdown +15 -11
- data/bin/gondola +51 -54
- data/gondola.gemspec +16 -12
- data/lib/gondola.rb +16 -2
- data/lib/gondola/commands.rb +0 -0
- data/lib/gondola/converters.rb +2 -0
- data/lib/gondola/{converter.rb → converters/base_converter.rb} +6 -6
- data/lib/gondola/{html_converter.rb → converters/html_converter.rb} +1 -1
- data/lib/gondola/results.rb +1 -0
- data/lib/gondola/results/console.rb +54 -0
- data/lib/gondola/selenium.rb +1 -1
- data/lib/gondola/suiterunner.rb +36 -16
- data/lib/gondola/tasks.rb +15 -0
- data/lib/gondola/tester.rb +8 -6
- data/lib/gondola/version.rb +2 -2
- data/test/test_fail.rb +2 -2
- data/test/test_pass.rb +2 -2
- data/test/test_suiterunner.rb +2 -2
- metadata +13 -10
data/Gemfile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem "sauce", "
|
3
|
+
gem "sauce", ">= 0.19.0"
|
4
4
|
gem "parallel", "~> 0.5.2"
|
5
5
|
|
6
6
|
group :development do
|
7
7
|
gem "shoulda", ">= 0"
|
8
8
|
gem "bundler", "~> 1.0.0"
|
9
9
|
gem "jeweler", "~> 1.5.2"
|
10
|
-
gem "vcr", "
|
10
|
+
gem "vcr", ">= 1.7.1"
|
11
11
|
gem "fakeweb", "~> 1.3.0"
|
12
12
|
end
|
data/Gemfile.lock
CHANGED
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
json (1.5.1)
|
17
17
|
json_pure (1.5.1)
|
18
18
|
mime-types (1.16)
|
19
|
-
net-ssh (2.1.
|
19
|
+
net-ssh (2.1.4)
|
20
20
|
net-ssh-gateway (1.0.1)
|
21
21
|
net-ssh (>= 1.99.1)
|
22
22
|
parallel (0.5.3)
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
rest-client (1.6.1)
|
25
25
|
mime-types (>= 1.16)
|
26
26
|
rubyzip (0.9.4)
|
27
|
-
sauce (0.
|
27
|
+
sauce (1.0.0)
|
28
28
|
childprocess (>= 0.1.6)
|
29
29
|
cmdparse (>= 2.0.2)
|
30
30
|
highline (>= 1.5.0)
|
@@ -33,13 +33,13 @@ GEM
|
|
33
33
|
net-ssh-gateway
|
34
34
|
rest-client
|
35
35
|
selenium-webdriver (>= 0.1.4)
|
36
|
-
selenium-webdriver (0.
|
36
|
+
selenium-webdriver (0.2.0)
|
37
37
|
childprocess (>= 0.1.7)
|
38
38
|
ffi (>= 1.0.7)
|
39
39
|
json_pure
|
40
40
|
rubyzip
|
41
41
|
shoulda (2.11.3)
|
42
|
-
vcr (1.
|
42
|
+
vcr (1.9.0)
|
43
43
|
|
44
44
|
PLATFORMS
|
45
45
|
ruby
|
@@ -49,6 +49,6 @@ DEPENDENCIES
|
|
49
49
|
fakeweb (~> 1.3.0)
|
50
50
|
jeweler (~> 1.5.2)
|
51
51
|
parallel (~> 0.5.2)
|
52
|
-
sauce (
|
52
|
+
sauce (>= 0.19.0)
|
53
53
|
shoulda
|
54
|
-
vcr (
|
54
|
+
vcr (>= 1.7.1)
|
data/README.markdown
CHANGED
@@ -67,17 +67,21 @@ The `[tests]` attribute refers to a list of test cases or test suites:
|
|
67
67
|
{:os => "Windows 2003", :browser => "iexplore", :browser_version => "8" },
|
68
68
|
]
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
70
|
+
Gondola.new do |runner|
|
71
|
+
runner.on_change do |result|
|
72
|
+
Gondola::Results::Console.change result
|
73
|
+
end
|
74
|
+
runner.on_completion do |results|
|
75
|
+
Gondola::Results::Console.completion results
|
76
|
+
end
|
77
|
+
runner.on_error do |error|
|
78
|
+
Gondola::Results::Console.error error
|
79
|
+
end
|
80
|
+
|
81
|
+
runner.add_tests "example1.html", "example2.html"
|
82
|
+
puts "Contacting Sauce Labs, please wait..."
|
83
|
+
runner.run({:base_url => "http://www.google.com", :browsers => browsers})
|
84
|
+
end
|
81
85
|
|
82
86
|
The end result here is that the test case that you have written with Selenium IDE, "example.html", is converted to ruby on the fly and then sent
|
83
87
|
to Sauce Labs with two browser settings in parallel.
|
data/bin/gondola
CHANGED
@@ -26,7 +26,7 @@ class RunCommand < CmdParse::Command
|
|
26
26
|
super('run', false)
|
27
27
|
@opts = {}
|
28
28
|
@quiet = false
|
29
|
-
self.short_desc = "Run
|
29
|
+
self.short_desc = "Run a test case or suite"
|
30
30
|
# User supplied options for running a suite
|
31
31
|
self.options = CmdParse::OptionParserWrapper.new do |opt|
|
32
32
|
opt.on('-r', '--recursive', 'Execute all sub suites') do |r|
|
@@ -43,70 +43,67 @@ class RunCommand < CmdParse::Command
|
|
43
43
|
"Usage: #{commandparser.program_name} run [options] [tests]"
|
44
44
|
end
|
45
45
|
|
46
|
-
#
|
47
|
-
def
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
puts "#{result[:id]}: Started test \"#{result[:name]}\" with #{bs}"
|
52
|
-
elsif result[:status] == :not_started
|
53
|
-
puts "#{result[:id]}: \"#{result[:name]}\" failed to start"
|
54
|
-
else
|
55
|
-
num = result[:errors].size
|
56
|
-
puts "#{result[:id]}: \"#{result[:name]}\" with #{bs}has completed with #{num} errors"
|
46
|
+
# Function that is executed when a user issues a run command
|
47
|
+
def execute(args)
|
48
|
+
if args.length < 1
|
49
|
+
usage
|
50
|
+
exit 1
|
57
51
|
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
results.each do |r|
|
64
|
-
puts "Sauce Labs ID : #{r[:id]}"
|
65
|
-
puts "Test Name : #{r[:name]}"
|
66
|
-
bs = ""
|
67
|
-
r[:browser].each_value { |v| bs = bs + "#{v} " }
|
68
|
-
puts "Browser : #{bs}"
|
69
|
-
if r[:status] == :passed
|
70
|
-
puts "Status : Test Passed"
|
71
|
-
else
|
72
|
-
puts "Status : Test Failed - #{r[:errors].size} error(s)"
|
73
|
-
r[:errors].each_with_index do |e,i|
|
74
|
-
puts "- Error #{i+1}, Command number #{e[:cmd_num]}:"
|
75
|
-
max_key = 0
|
76
|
-
e[:command].each_key { |k| max_key = k.size if k.size > max_key }
|
77
|
-
max_key = -1 * (max_key + 8)
|
78
|
-
e[:command].each_pair do |k,v|
|
79
|
-
puts " %1$*2$s : #{v}" % [ "#{k.capitalize} command", max_key ]
|
80
|
-
end
|
81
|
-
puts " #{e[:error]}"
|
52
|
+
# Can either provide directory or file
|
53
|
+
Gondola.new do |runner|
|
54
|
+
unless @quiet
|
55
|
+
runner.on_change do |result|
|
56
|
+
Gondola::Results::Console.change result
|
82
57
|
end
|
58
|
+
runner.on_completion do |results|
|
59
|
+
Gondola::Results::Console.completion results
|
60
|
+
end
|
61
|
+
end
|
62
|
+
runner.on_error do |error|
|
63
|
+
Gondola::Results::Console.error error
|
83
64
|
end
|
84
|
-
|
65
|
+
|
66
|
+
runner.add_tests *args
|
67
|
+
puts "Contacting Sauce Labs, please wait..." unless @quiet
|
68
|
+
runner.run @opts
|
85
69
|
end
|
86
70
|
end
|
71
|
+
end
|
72
|
+
cmd.add_command(RunCommand.new)
|
73
|
+
|
74
|
+
# New Project command
|
75
|
+
class ProjectCommand < CmdParse::Command
|
76
|
+
def initialize
|
77
|
+
super('project', false)
|
78
|
+
self.short_desc = "Creates a new project folder"
|
79
|
+
end
|
80
|
+
|
81
|
+
def usage
|
82
|
+
"Usage: #{commandparser.program_name} new project [name]"
|
83
|
+
end
|
87
84
|
|
88
|
-
# Function that is executed when a user issues a run command
|
89
85
|
def execute(args)
|
90
86
|
if args.length < 1
|
91
|
-
|
87
|
+
usage
|
92
88
|
exit 1
|
93
89
|
end
|
94
|
-
|
95
|
-
|
96
|
-
runner.add_observer(self) unless @quiet
|
97
|
-
args.each do |t|
|
98
|
-
if File.exists? t
|
99
|
-
runner.add_test t
|
100
|
-
else
|
101
|
-
puts "Could not find \"#{t}\""
|
102
|
-
end
|
103
|
-
end
|
104
|
-
puts "Contacting Sauce Labs, please wait..." unless @quiet
|
105
|
-
runner.run(@opts)
|
106
|
-
report(runner.results) unless @quiet
|
90
|
+
|
91
|
+
args.each { |p| Dir.mkdir p }
|
107
92
|
end
|
108
93
|
end
|
109
|
-
|
94
|
+
|
95
|
+
# New command
|
96
|
+
class NewCommand < CmdParse::Command
|
97
|
+
def initialize
|
98
|
+
super('new', true)
|
99
|
+
self.short_desc = "Creates a new entity"
|
100
|
+
self.add_command(ProjectCommand.new)
|
101
|
+
end
|
102
|
+
|
103
|
+
def usage
|
104
|
+
"Usage: #{commandparser.program_name} new COMMAND [args]"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
cmd.add_command(NewCommand.new)
|
110
108
|
|
111
109
|
cmd.parse
|
112
|
-
exit(0)
|
data/gondola.gemspec
CHANGED
@@ -5,12 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gondola}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matthew Perry"]
|
12
|
-
s.date = %q{2011-
|
13
|
-
s.default_executable = %q{gondola}
|
12
|
+
s.date = %q{2011-05-02}
|
14
13
|
s.description = %q{
|
15
14
|
Gondola is Ruby command line utility and as well as a library which helps
|
16
15
|
for integrate the Selenium IDE more tightly with Sauce Labs' Ondemand services and
|
@@ -33,10 +32,15 @@ Gem::Specification.new do |s|
|
|
33
32
|
"bin/gondola",
|
34
33
|
"gondola.gemspec",
|
35
34
|
"lib/gondola.rb",
|
36
|
-
"lib/gondola/
|
37
|
-
"lib/gondola/
|
35
|
+
"lib/gondola/commands.rb",
|
36
|
+
"lib/gondola/converters.rb",
|
37
|
+
"lib/gondola/converters/base_converter.rb",
|
38
|
+
"lib/gondola/converters/html_converter.rb",
|
39
|
+
"lib/gondola/results.rb",
|
40
|
+
"lib/gondola/results/console.rb",
|
38
41
|
"lib/gondola/selenium.rb",
|
39
42
|
"lib/gondola/suiterunner.rb",
|
43
|
+
"lib/gondola/tasks.rb",
|
40
44
|
"lib/gondola/tester.rb",
|
41
45
|
"lib/gondola/version.rb",
|
42
46
|
"test/helper.rb",
|
@@ -55,7 +59,7 @@ Gem::Specification.new do |s|
|
|
55
59
|
s.homepage = %q{http://github.com/perrym5/gondola}
|
56
60
|
s.licenses = ["MIT"]
|
57
61
|
s.require_paths = ["lib"]
|
58
|
-
s.rubygems_version = %q{1.
|
62
|
+
s.rubygems_version = %q{1.7.2}
|
59
63
|
s.summary = %q{Ruby command line utility and library for integrating the Selenium IDE more tightly with Sauce Labs' Ondemand services}
|
60
64
|
s.test_files = [
|
61
65
|
"test/helper.rb",
|
@@ -71,29 +75,29 @@ Gem::Specification.new do |s|
|
|
71
75
|
s.specification_version = 3
|
72
76
|
|
73
77
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
74
|
-
s.add_runtime_dependency(%q<sauce>, ["
|
78
|
+
s.add_runtime_dependency(%q<sauce>, [">= 0.19.0"])
|
75
79
|
s.add_runtime_dependency(%q<parallel>, ["~> 0.5.2"])
|
76
80
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
77
81
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
78
82
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
79
|
-
s.add_development_dependency(%q<vcr>, ["
|
83
|
+
s.add_development_dependency(%q<vcr>, [">= 1.7.1"])
|
80
84
|
s.add_development_dependency(%q<fakeweb>, ["~> 1.3.0"])
|
81
85
|
else
|
82
|
-
s.add_dependency(%q<sauce>, ["
|
86
|
+
s.add_dependency(%q<sauce>, [">= 0.19.0"])
|
83
87
|
s.add_dependency(%q<parallel>, ["~> 0.5.2"])
|
84
88
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
85
89
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
86
90
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
87
|
-
s.add_dependency(%q<vcr>, ["
|
91
|
+
s.add_dependency(%q<vcr>, [">= 1.7.1"])
|
88
92
|
s.add_dependency(%q<fakeweb>, ["~> 1.3.0"])
|
89
93
|
end
|
90
94
|
else
|
91
|
-
s.add_dependency(%q<sauce>, ["
|
95
|
+
s.add_dependency(%q<sauce>, [">= 0.19.0"])
|
92
96
|
s.add_dependency(%q<parallel>, ["~> 0.5.2"])
|
93
97
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
94
98
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
95
99
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
96
|
-
s.add_dependency(%q<vcr>, ["
|
100
|
+
s.add_dependency(%q<vcr>, [">= 1.7.1"])
|
97
101
|
s.add_dependency(%q<fakeweb>, ["~> 1.3.0"])
|
98
102
|
end
|
99
103
|
end
|
data/lib/gondola.rb
CHANGED
@@ -1,9 +1,23 @@
|
|
1
|
+
# Gondola - gondola.rb
|
2
|
+
# Main include file as well as the top level
|
3
|
+
# class definition for gondola
|
4
|
+
|
1
5
|
require 'rubygems'
|
2
6
|
require 'gondola/selenium'
|
3
|
-
require 'gondola/
|
4
|
-
require 'gondola/
|
7
|
+
require 'gondola/converters'
|
8
|
+
require 'gondola/commands'
|
9
|
+
require 'gondola/results'
|
5
10
|
require 'gondola/tester'
|
6
11
|
require 'gondola/suiterunner'
|
7
12
|
require 'gondola/version'
|
8
13
|
require 'sauce'
|
9
14
|
require 'parallel'
|
15
|
+
|
16
|
+
class Gondola
|
17
|
+
attr_reader :runner
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@runner = Gondola::SuiteRunner.new
|
21
|
+
yield @runner if block_given?
|
22
|
+
end
|
23
|
+
end
|
File without changes
|
@@ -1,21 +1,21 @@
|
|
1
|
-
# Gondola -
|
1
|
+
# Gondola - base_converter.rb:
|
2
2
|
# Class definition for turning one format into
|
3
3
|
# another
|
4
4
|
|
5
|
-
|
5
|
+
class Gondola
|
6
6
|
class Converter
|
7
7
|
attr_writer :name
|
8
8
|
attr_reader :file, :commands
|
9
9
|
|
10
10
|
# Constructor that opens a file
|
11
|
-
def initialize(filename
|
11
|
+
def initialize(filename)
|
12
12
|
File.open(filename, "r") do |f|
|
13
13
|
@body = f.read
|
14
14
|
end
|
15
15
|
@commands = []
|
16
|
-
@s_obj =
|
16
|
+
@s_obj = Gondola::Tester::SELENIUM_OBJECT
|
17
17
|
@file = filename
|
18
|
-
ruby
|
18
|
+
ruby
|
19
19
|
end
|
20
20
|
|
21
21
|
def name
|
@@ -32,7 +32,7 @@ module Gondola
|
|
32
32
|
unless @ruby
|
33
33
|
@ruby = ""
|
34
34
|
@body.each_line do |l|
|
35
|
-
@commands
|
35
|
+
@commands << {:ruby => l}
|
36
36
|
@ruby << l
|
37
37
|
end
|
38
38
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'gondola/results/console'
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Gondola - console.rb
|
2
|
+
# Definitions of functions for printing
|
3
|
+
# results to the console in a readable format
|
4
|
+
|
5
|
+
class Gondola
|
6
|
+
module Results
|
7
|
+
class Console
|
8
|
+
def self.change(result)
|
9
|
+
browser_string = result[:browser].values.join(" ")
|
10
|
+
print "#{result[:id]}: \"#{result[:name]}\" "
|
11
|
+
|
12
|
+
case result[:status]
|
13
|
+
when :in_progress
|
14
|
+
puts "started with #{browser_string}"
|
15
|
+
when :not_started
|
16
|
+
puts "failed to start on #{browser_string}"
|
17
|
+
when :passed, :failed
|
18
|
+
puts "has completed with #{result[:errors].size} error(s) on #{browser_string}"
|
19
|
+
else
|
20
|
+
puts "Unknown status code"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.completion(results)
|
25
|
+
puts
|
26
|
+
results.each do |result|
|
27
|
+
puts "Sauce Labs ID : #{result[:id]}"
|
28
|
+
puts "Test Name : #{result[:name]}"
|
29
|
+
puts "Browser : #{result[:browser].values.join(" ")}"
|
30
|
+
puts "Status : Test #{result[:status].to_s.capitalize} - #{result[:errors].size} error(s)"
|
31
|
+
if result[:status] == :failed
|
32
|
+
result[:errors].each_with_index do |error,i|
|
33
|
+
puts "- Error #{i+1}, Command number #{error[:cmd_num]}:"
|
34
|
+
|
35
|
+
max_key = -1 * (error[:command].keys.map { |k| k.to_s.size }.max + 8)
|
36
|
+
error[:command].each_pair do |k,v|
|
37
|
+
puts " %1$*2$s : #{v}" % [ "#{k.to_s.capitalize} command", max_key ]
|
38
|
+
end
|
39
|
+
|
40
|
+
puts " #{error[:error]}"
|
41
|
+
end
|
42
|
+
else
|
43
|
+
puts
|
44
|
+
end
|
45
|
+
puts
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.error(error)
|
50
|
+
puts error
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/gondola/selenium.rb
CHANGED
data/lib/gondola/suiterunner.rb
CHANGED
@@ -1,22 +1,27 @@
|
|
1
1
|
# Gondola v2 - suiterunner.rb:
|
2
2
|
# A wrapper for all the tasks required for launching a run
|
3
3
|
# of a test suite or test case on several browsers
|
4
|
-
require 'observer'
|
5
4
|
|
6
|
-
|
5
|
+
class Gondola
|
7
6
|
class SuiteRunner
|
8
|
-
include Observable
|
9
7
|
attr_reader :tests, :results
|
10
8
|
|
11
9
|
def initialize
|
12
10
|
@tests = []
|
13
11
|
@results = []
|
12
|
+
yield self if block_given?
|
14
13
|
end
|
15
14
|
|
16
15
|
# Function to add a test to the member array of
|
17
16
|
# tests for this test run
|
18
|
-
def
|
19
|
-
|
17
|
+
def add_tests(*files)
|
18
|
+
files.each do |file|
|
19
|
+
unless File.exists? file
|
20
|
+
@error.call "Could not find \"#{file}\"" unless @error.nil?
|
21
|
+
next
|
22
|
+
end
|
23
|
+
@tests << file
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
# Function to run all tests that have been added
|
@@ -38,6 +43,7 @@ module Gondola
|
|
38
43
|
end
|
39
44
|
files = Dir.glob(prepend + "*.html")
|
40
45
|
files.concat(Dir.glob(prepend + "*.rb"))
|
46
|
+
@error.call "No runnable files in \"#{file}\"" if files.empty? and !@error.nil?
|
41
47
|
files.each do |file|
|
42
48
|
converter,global,browsers = aggregate_data(file, opts)
|
43
49
|
run_test(converter, global, browsers)
|
@@ -51,6 +57,24 @@ module Gondola
|
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
60
|
+
|
61
|
+
# Run the supplied completion block
|
62
|
+
@complete.call @results unless @complete.nil?
|
63
|
+
end
|
64
|
+
|
65
|
+
# Set a block for executing when a change occurs
|
66
|
+
def on_change(&change_block)
|
67
|
+
@change = change_block
|
68
|
+
end
|
69
|
+
|
70
|
+
# Set a block for executing when the run is complete
|
71
|
+
def on_completion(&complete_block)
|
72
|
+
@complete = complete_block
|
73
|
+
end
|
74
|
+
|
75
|
+
# Set a block for executing when there is a problem
|
76
|
+
def on_error(&error_block)
|
77
|
+
@error = error_block
|
54
78
|
end
|
55
79
|
|
56
80
|
private
|
@@ -101,10 +125,7 @@ module Gondola
|
|
101
125
|
api = false
|
102
126
|
end
|
103
127
|
end
|
104
|
-
if File.exists? "config.yml"
|
105
|
-
conf.merge! YAML.load_file("config.yml")
|
106
|
-
data = false
|
107
|
-
end
|
128
|
+
conf.merge! YAML.load_file("config.yml") if File.exists? "config.yml"
|
108
129
|
end
|
109
130
|
|
110
131
|
# Recurse through the parent directories and merge the
|
@@ -126,27 +147,26 @@ module Gondola
|
|
126
147
|
|
127
148
|
# Initialize test
|
128
149
|
tester.setup
|
129
|
-
changed # Notify Observers
|
130
150
|
result = {
|
131
151
|
:id => tester.job_id,
|
132
152
|
:name => global[:job_name],
|
133
153
|
:browser => browser,
|
134
|
-
:status => tester.status
|
154
|
+
:status => tester.status,
|
155
|
+
:errors => tester.errors
|
135
156
|
}
|
136
157
|
# Send information to any observers
|
137
|
-
|
158
|
+
@change.call result unless @change.nil?
|
138
159
|
|
139
160
|
# Run test
|
140
|
-
tester.begin
|
141
|
-
changed # Notify Observers
|
161
|
+
tester.begin if result[:errors].empty?
|
142
162
|
result[:status] = tester.status
|
143
163
|
# Record the results of the test
|
144
164
|
result[:errors] = tester.errors
|
145
165
|
# Send information to any observers
|
146
|
-
|
166
|
+
@change.call result unless @change.nil?
|
147
167
|
|
148
168
|
# Add result to the suiterunner's list
|
149
|
-
@results
|
169
|
+
@results << result
|
150
170
|
end
|
151
171
|
end
|
152
172
|
end
|
data/lib/gondola/tester.rb
CHANGED
@@ -3,13 +3,15 @@
|
|
3
3
|
# for asserting and verifying various functions without
|
4
4
|
# the need for a unit testing framework
|
5
5
|
|
6
|
-
|
6
|
+
class Gondola
|
7
7
|
class AssertionError < RuntimeError
|
8
8
|
end
|
9
9
|
|
10
10
|
class Tester
|
11
11
|
attr_reader :errors, :job_id, :status
|
12
12
|
|
13
|
+
SELENIUM_OBJECT = "@sel"
|
14
|
+
|
13
15
|
def initialize(req, converter)
|
14
16
|
@sel = Gondola::Selenium.new req
|
15
17
|
@converter = converter
|
@@ -20,13 +22,12 @@ module Gondola
|
|
20
22
|
# Start a new Sauce Labs' job and return the session_id
|
21
23
|
def setup
|
22
24
|
begin
|
23
|
-
@sel.start
|
25
|
+
@sel.start
|
24
26
|
@job_id = @sel.session_id
|
25
27
|
@status = :in_progress
|
26
28
|
rescue ::Selenium::Client::CommandError => e
|
27
29
|
@status = :not_started
|
28
30
|
add_error e.message, e.backtrace
|
29
|
-
finish
|
30
31
|
end
|
31
32
|
@job_id
|
32
33
|
end
|
@@ -34,7 +35,7 @@ module Gondola
|
|
34
35
|
# Issue all the test commands, catching any errors
|
35
36
|
def begin
|
36
37
|
begin
|
37
|
-
eval
|
38
|
+
eval @converter.ruby
|
38
39
|
rescue AssertionError
|
39
40
|
rescue ::Selenium::Client::CommandError => e
|
40
41
|
add_error e.message, e.backtrace
|
@@ -56,13 +57,14 @@ module Gondola
|
|
56
57
|
@status = :failed
|
57
58
|
@sel.failed!
|
58
59
|
end
|
59
|
-
@sel.stop
|
60
|
+
@sel.stop
|
60
61
|
rescue ::Selenium::Client::CommandError
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
64
65
|
def get_cmd_num(trace)
|
65
66
|
ev = trace.delete_if { |c| !(c =~ /\(eval\)/) }[0]
|
67
|
+
return 0 unless ev
|
66
68
|
ev.match(/:(\d+)/)[1].to_i
|
67
69
|
end
|
68
70
|
|
@@ -72,7 +74,7 @@ module Gondola
|
|
72
74
|
cmd_num = get_cmd_num(trace)
|
73
75
|
@errors.push({
|
74
76
|
:cmd_num => cmd_num,
|
75
|
-
:command => @converter.commands[cmd_num-1],
|
77
|
+
:command => cmd_num ? @converter.commands[cmd_num-1] : "#{SELENIUM_OBJECT}.start",
|
76
78
|
:error => desc
|
77
79
|
})
|
78
80
|
end
|
data/lib/gondola/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "1.
|
1
|
+
class Gondola
|
2
|
+
VERSION = "1.3.0"
|
3
3
|
end
|
data/test/test_fail.rb
CHANGED
@@ -10,7 +10,7 @@ class TestFail < Test::Unit::TestCase
|
|
10
10
|
context "A Ruby Failing Test" do
|
11
11
|
setup do
|
12
12
|
@runner = Gondola::SuiteRunner.new
|
13
|
-
@runner.
|
13
|
+
@runner.add_tests "test/test_projects/example2/gondola_agora_fail.rb"
|
14
14
|
end
|
15
15
|
|
16
16
|
should "result in a failing test" do
|
@@ -32,7 +32,7 @@ class TestFail < Test::Unit::TestCase
|
|
32
32
|
context "An HTML Failing Test" do
|
33
33
|
setup do
|
34
34
|
@runner = Gondola::SuiteRunner.new
|
35
|
-
@runner.
|
35
|
+
@runner.add_tests "test/test_projects/example1/gondola_agora_fail.html"
|
36
36
|
end
|
37
37
|
|
38
38
|
should "result in a failing test" do
|
data/test/test_pass.rb
CHANGED
@@ -10,7 +10,7 @@ class TestPass < Test::Unit::TestCase
|
|
10
10
|
context "A Ruby Passing Test" do
|
11
11
|
setup do
|
12
12
|
@runner = Gondola::SuiteRunner.new
|
13
|
-
@runner.
|
13
|
+
@runner.add_tests "test/test_projects/example2/gondola_agora_pass.rb"
|
14
14
|
end
|
15
15
|
|
16
16
|
should "result in a passing test" do
|
@@ -25,7 +25,7 @@ class TestPass < Test::Unit::TestCase
|
|
25
25
|
context "An HTML Passing Test" do
|
26
26
|
setup do
|
27
27
|
@runner = Gondola::SuiteRunner.new
|
28
|
-
@runner.
|
28
|
+
@runner.add_tests "test/test_projects/example1/gondola_agora_pass.html"
|
29
29
|
end
|
30
30
|
|
31
31
|
should "result in a passing test" do
|
data/test/test_suiterunner.rb
CHANGED
@@ -18,7 +18,7 @@ class SuiteRunner < Test::Unit::TestCase
|
|
18
18
|
context "Recursive projects" do
|
19
19
|
setup do
|
20
20
|
@runner = MockSuiteRunner.new
|
21
|
-
@runner.
|
21
|
+
@runner.add_tests "test/test_projects/"
|
22
22
|
@runner.run :recursive => true
|
23
23
|
end
|
24
24
|
|
@@ -35,7 +35,7 @@ class SuiteRunner < Test::Unit::TestCase
|
|
35
35
|
context "Configs" do
|
36
36
|
setup do
|
37
37
|
@runner = MockSuiteRunner.new
|
38
|
-
@runner.
|
38
|
+
@runner.add_tests "test/test_projects/"
|
39
39
|
end
|
40
40
|
|
41
41
|
should "extract data from config files and merge correctly" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gondola
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matthew Perry
|
@@ -10,15 +10,14 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable: gondola
|
13
|
+
date: 2011-05-02 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: sauce
|
18
17
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
18
|
none: false
|
20
19
|
requirements:
|
21
|
-
- -
|
20
|
+
- - ">="
|
22
21
|
- !ruby/object:Gem::Version
|
23
22
|
version: 0.19.0
|
24
23
|
type: :runtime
|
@@ -73,7 +72,7 @@ dependencies:
|
|
73
72
|
requirement: &id006 !ruby/object:Gem::Requirement
|
74
73
|
none: false
|
75
74
|
requirements:
|
76
|
-
- -
|
75
|
+
- - ">="
|
77
76
|
- !ruby/object:Gem::Version
|
78
77
|
version: 1.7.1
|
79
78
|
type: :development
|
@@ -109,10 +108,15 @@ files:
|
|
109
108
|
- bin/gondola
|
110
109
|
- gondola.gemspec
|
111
110
|
- lib/gondola.rb
|
112
|
-
- lib/gondola/
|
113
|
-
- lib/gondola/
|
111
|
+
- lib/gondola/commands.rb
|
112
|
+
- lib/gondola/converters.rb
|
113
|
+
- lib/gondola/converters/base_converter.rb
|
114
|
+
- lib/gondola/converters/html_converter.rb
|
115
|
+
- lib/gondola/results.rb
|
116
|
+
- lib/gondola/results/console.rb
|
114
117
|
- lib/gondola/selenium.rb
|
115
118
|
- lib/gondola/suiterunner.rb
|
119
|
+
- lib/gondola/tasks.rb
|
116
120
|
- lib/gondola/tester.rb
|
117
121
|
- lib/gondola/version.rb
|
118
122
|
- test/helper.rb
|
@@ -127,7 +131,6 @@ files:
|
|
127
131
|
- test/test_projects/example2/gondola_agora_fail.rb
|
128
132
|
- test/test_projects/example2/gondola_agora_pass.rb
|
129
133
|
- test/test_suiterunner.rb
|
130
|
-
has_rdoc: true
|
131
134
|
homepage: http://github.com/perrym5/gondola
|
132
135
|
licenses:
|
133
136
|
- MIT
|
@@ -141,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
144
|
requirements:
|
142
145
|
- - ">="
|
143
146
|
- !ruby/object:Gem::Version
|
144
|
-
hash:
|
147
|
+
hash: 1061792883
|
145
148
|
segments:
|
146
149
|
- 0
|
147
150
|
version: "0"
|
@@ -154,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
157
|
requirements: []
|
155
158
|
|
156
159
|
rubyforge_project:
|
157
|
-
rubygems_version: 1.
|
160
|
+
rubygems_version: 1.7.2
|
158
161
|
signing_key:
|
159
162
|
specification_version: 3
|
160
163
|
summary: Ruby command line utility and library for integrating the Selenium IDE more tightly with Sauce Labs' Ondemand services
|