gondola 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.markdown +2 -3
- data/bin/gondola +48 -22
- data/gondola.gemspec +8 -8
- data/lib/gondola/html_converter.rb +1 -1
- data/lib/gondola/{testrunner.rb → suiterunner.rb} +54 -41
- data/lib/gondola/tester.rb +57 -54
- data/lib/gondola/version.rb +1 -1
- data/lib/gondola.rb +1 -1
- data/test/test_converter.rb +2 -0
- data/test/test_fail.rb +21 -19
- data/test/test_pass.rb +6 -6
- data/test/{test_testrunner.rb → test_suiterunner.rb} +4 -4
- metadata +7 -7
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.markdown
CHANGED
@@ -47,10 +47,9 @@ Will get you started with the basic commands available. The most used and main f
|
|
47
47
|
|
48
48
|
The available `[options]` are:
|
49
49
|
|
50
|
-
* `-s` or `--super_parallel`: This activates "super\_parallel" mode which will not only execute all browsers in parallel but also all the
|
51
|
-
test cases. This mode is experimental and may slow down Sauce Labs considerably. Use at your own risk.
|
52
50
|
* `-r` or `--recursive`: This activates recursive search mode. When you supply Gondola with a directory containing tests, using this option will
|
53
51
|
enable sub directory searching.
|
52
|
+
* `-q` or `--quiet`: This suppreses the standard output. Best used when you need to run tests in the background.
|
54
53
|
|
55
54
|
The `[tests]` attribute refers to a list of test cases or test suites:
|
56
55
|
|
@@ -68,7 +67,7 @@ The `[tests]` attribute refers to a list of test cases or test suites:
|
|
68
67
|
{:os => "Windows 2003", :browser => "iexplore", :browser_version => "8" },
|
69
68
|
]
|
70
69
|
|
71
|
-
runner = Gondola::
|
70
|
+
runner = Gondola::SuiteRunner.new
|
72
71
|
runner.add_test "example.html"
|
73
72
|
runner.run({:base_url => "http://www.google.com", :browsers => browsers})
|
74
73
|
results = runner.results
|
data/bin/gondola
CHANGED
@@ -25,15 +25,16 @@ class RunCommand < CmdParse::Command
|
|
25
25
|
def initialize
|
26
26
|
super('run', false)
|
27
27
|
@opts = {}
|
28
|
+
@quiet = false
|
28
29
|
self.short_desc = "Run an entire test suite or one test case"
|
29
30
|
# User supplied options for running a suite
|
30
31
|
self.options = CmdParse::OptionParserWrapper.new do |opt|
|
31
|
-
opt.on('-s', '--super_parallel', 'Execute all test cases at once') do |sp|
|
32
|
-
@opts[:super_parallel] = true
|
33
|
-
end
|
34
32
|
opt.on('-r', '--recursive', 'Execute all sub suites') do |r|
|
35
33
|
@opts[:recursive] = true
|
36
34
|
end
|
35
|
+
opt.on('-q', '--quiet', 'Execute quietly') do |q|
|
36
|
+
@quiet = true
|
37
|
+
end
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
@@ -42,6 +43,46 @@ class RunCommand < CmdParse::Command
|
|
42
43
|
"Usage: #{commandparser.program_name} run [options] [tests]"
|
43
44
|
end
|
44
45
|
|
46
|
+
# Observer function to watch the progress of runs
|
47
|
+
def update(result)
|
48
|
+
bs = ""
|
49
|
+
result[:browser].each_value { |v| bs = bs + "#{v} " }
|
50
|
+
if result[:status] == :in_progress
|
51
|
+
puts "#{result[:id]}: Started test \"#{result[:name]}\" with #{bs}"
|
52
|
+
else
|
53
|
+
num = result[:errors].size
|
54
|
+
puts "#{result[:id]}: \"#{result[:name]}\" with #{bs}has completed with #{num} errors"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Parse and print results in an organized manner
|
59
|
+
def report(results)
|
60
|
+
puts
|
61
|
+
results.each do |r|
|
62
|
+
puts "Sauce Labs ID : #{r[:id]}"
|
63
|
+
puts "Test Name : #{r[:name]}"
|
64
|
+
bs = ""
|
65
|
+
r[:browser].each_value { |v| bs = bs + "#{v} " }
|
66
|
+
puts "Browser : #{bs}"
|
67
|
+
if r[:status] == :passed
|
68
|
+
puts "Status : Test Passed"
|
69
|
+
else
|
70
|
+
puts "Status : Test Failed - #{r[:errors].size} error(s)"
|
71
|
+
r[:errors].each_with_index do |e,i|
|
72
|
+
puts "- Error #{i+1}, Command number #{e[:cmd_num]}:"
|
73
|
+
max_key = 0
|
74
|
+
e[:command].each_key { |k| max_key = k.size if k.size > max_key }
|
75
|
+
max_key = -1 * (max_key + 8)
|
76
|
+
e[:command].each_pair do |k,v|
|
77
|
+
puts " %1$*2$s : #{v}" % [ "#{k.capitalize} command", max_key ]
|
78
|
+
end
|
79
|
+
puts " #{e[:error]}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
puts
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
45
86
|
# Function that is executed when a user issues a run command
|
46
87
|
def execute(args)
|
47
88
|
if args.length < 1
|
@@ -49,7 +90,8 @@ class RunCommand < CmdParse::Command
|
|
49
90
|
exit 1
|
50
91
|
end
|
51
92
|
# Can either provide directory or file
|
52
|
-
runner = Gondola::
|
93
|
+
runner = Gondola::SuiteRunner.new
|
94
|
+
runner.add_observer(self) unless @quiet
|
53
95
|
args.each do |t|
|
54
96
|
if File.exists? t
|
55
97
|
runner.add_test t
|
@@ -57,25 +99,9 @@ class RunCommand < CmdParse::Command
|
|
57
99
|
puts "Could not find \"#{t}\""
|
58
100
|
end
|
59
101
|
end
|
102
|
+
puts "Contacting Sauce Labs, please wait..." unless @quiet
|
60
103
|
runner.run(@opts)
|
61
|
-
|
62
|
-
runner.results.each do |r|
|
63
|
-
puts "Sauce Labs ID: #{r[:id]}"
|
64
|
-
puts "Test Name: #{r[:name]}"
|
65
|
-
puts "Browser: #{r[:browser]}"
|
66
|
-
if r[:result] == "OK"
|
67
|
-
puts "Test Passed"
|
68
|
-
else
|
69
|
-
puts "Test Failed - #{r[:result].size} error(s)"
|
70
|
-
r[:result].each_with_index do |e,i|
|
71
|
-
puts "- Error #{i+1}:"
|
72
|
-
puts " Selenese Command: #{e[:command][:original]}" if e[:command][:original]
|
73
|
-
puts " Ruby Command: #{e[:command][:ruby]}" if e[:command][:ruby]
|
74
|
-
puts " #{e[:error]}"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
puts
|
78
|
-
end
|
104
|
+
report(runner.results) unless @quiet
|
79
105
|
end
|
80
106
|
end
|
81
107
|
cmd.add_command(RunCommand.new)
|
data/gondola.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gondola}
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.2"
|
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-03-
|
12
|
+
s.date = %q{2011-03-26}
|
13
13
|
s.default_executable = %q{gondola}
|
14
14
|
s.description = %q{
|
15
15
|
Gondola is Ruby command line utility and as well as a library which helps
|
@@ -36,8 +36,8 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/gondola/converter.rb",
|
37
37
|
"lib/gondola/html_converter.rb",
|
38
38
|
"lib/gondola/selenium.rb",
|
39
|
+
"lib/gondola/suiterunner.rb",
|
39
40
|
"lib/gondola/tester.rb",
|
40
|
-
"lib/gondola/testrunner.rb",
|
41
41
|
"lib/gondola/version.rb",
|
42
42
|
"test/helper.rb",
|
43
43
|
"test/test_converter.rb",
|
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
"test/test_projects/example2/config.yml",
|
51
51
|
"test/test_projects/example2/gondola_agora_fail.rb",
|
52
52
|
"test/test_projects/example2/gondola_agora_pass.rb",
|
53
|
-
"test/
|
53
|
+
"test/test_suiterunner.rb"
|
54
54
|
]
|
55
55
|
s.homepage = %q{http://github.com/perrym5/gondola}
|
56
56
|
s.licenses = ["MIT"]
|
@@ -64,14 +64,14 @@ Gem::Specification.new do |s|
|
|
64
64
|
"test/test_pass.rb",
|
65
65
|
"test/test_projects/example2/gondola_agora_fail.rb",
|
66
66
|
"test/test_projects/example2/gondola_agora_pass.rb",
|
67
|
-
"test/
|
67
|
+
"test/test_suiterunner.rb"
|
68
68
|
]
|
69
69
|
|
70
70
|
if s.respond_to? :specification_version then
|
71
71
|
s.specification_version = 3
|
72
72
|
|
73
73
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
74
|
-
s.add_runtime_dependency(%q<sauce>, [">= 0.
|
74
|
+
s.add_runtime_dependency(%q<sauce>, [">= 0.19.0"])
|
75
75
|
s.add_runtime_dependency(%q<parallel>, [">= 0.5.2"])
|
76
76
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
77
77
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -79,7 +79,7 @@ Gem::Specification.new do |s|
|
|
79
79
|
s.add_development_dependency(%q<vcr>, ["~> 1.7.1"])
|
80
80
|
s.add_development_dependency(%q<fakeweb>, ["~> 1.3.0"])
|
81
81
|
else
|
82
|
-
s.add_dependency(%q<sauce>, [">= 0.
|
82
|
+
s.add_dependency(%q<sauce>, [">= 0.19.0"])
|
83
83
|
s.add_dependency(%q<parallel>, [">= 0.5.2"])
|
84
84
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
85
85
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -88,7 +88,7 @@ Gem::Specification.new do |s|
|
|
88
88
|
s.add_dependency(%q<fakeweb>, ["~> 1.3.0"])
|
89
89
|
end
|
90
90
|
else
|
91
|
-
s.add_dependency(%q<sauce>, [">= 0.
|
91
|
+
s.add_dependency(%q<sauce>, [">= 0.19.0"])
|
92
92
|
s.add_dependency(%q<parallel>, [">= 0.5.2"])
|
93
93
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
94
94
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -50,7 +50,7 @@ module Gondola
|
|
50
50
|
selenese = selenese + ", #{cmd[2]}" if cmd[2] != ""
|
51
51
|
selenese = selenese + ")"
|
52
52
|
ruby = html_to_ruby(cmd[0], args)
|
53
|
-
@commands.push({ :
|
53
|
+
@commands.push({ :selenese => selenese, :ruby => ruby })
|
54
54
|
@ruby << ruby
|
55
55
|
@ruby << "\ncmd_inc\n"
|
56
56
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
-
# Gondola v2 -
|
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'
|
4
5
|
|
5
6
|
module Gondola
|
6
|
-
class
|
7
|
+
class SuiteRunner
|
8
|
+
include Observable
|
7
9
|
attr_reader :tests, :results
|
8
10
|
|
9
11
|
def initialize
|
@@ -25,32 +27,28 @@ module Gondola
|
|
25
27
|
if @tests.empty?
|
26
28
|
puts "No tests to run"
|
27
29
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
prepend = ""
|
37
|
-
if opts[:recursive] == true
|
38
|
-
prepend = "**/"
|
39
|
-
end
|
40
|
-
files = Dir.glob(prepend + "*.html")
|
41
|
-
files.concat(Dir.glob(prepend + "*.rb"))
|
42
|
-
files.each do |file|
|
43
|
-
converter,global,browsers = aggregate_data(file, opts)
|
44
|
-
run_test(converter, global, browsers)
|
45
|
-
end
|
30
|
+
|
31
|
+
# Iterate over all tests and dispatch each to Sauce Labs
|
32
|
+
@tests.each do |test|
|
33
|
+
if File.directory? test
|
34
|
+
Dir.chdir(test) do
|
35
|
+
prepend = ""
|
36
|
+
if opts[:recursive] == true
|
37
|
+
prepend = "**/"
|
46
38
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
39
|
+
files = Dir.glob(prepend + "*.html")
|
40
|
+
files.concat(Dir.glob(prepend + "*.rb"))
|
41
|
+
files.each do |file|
|
42
|
+
converter,global,browsers = aggregate_data(file, opts)
|
43
|
+
run_test(converter, global, browsers)
|
52
44
|
end
|
53
45
|
end
|
46
|
+
else
|
47
|
+
file = File.basename(test)
|
48
|
+
Dir.chdir(File.dirname(test)) do
|
49
|
+
converter,global,browsers = aggregate_data(file, opts)
|
50
|
+
run_test(converter, global, browsers)
|
51
|
+
end
|
54
52
|
end
|
55
53
|
end
|
56
54
|
end
|
@@ -66,10 +64,12 @@ module Gondola
|
|
66
64
|
elsif File.extname(file) == '.rb'
|
67
65
|
converter = Gondola::Converter.new(file)
|
68
66
|
end
|
67
|
+
|
69
68
|
# Load file config data
|
70
69
|
conf = config_from_file(file)
|
71
70
|
# Merge in user-supplied data
|
72
71
|
conf.merge! opts
|
72
|
+
|
73
73
|
# Set global information
|
74
74
|
global = {}
|
75
75
|
global[:job_name] = converter.name
|
@@ -90,6 +90,7 @@ module Gondola
|
|
90
90
|
unless File.directory? file
|
91
91
|
return config_from_file(File.expand_path(File.dirname(file)))
|
92
92
|
end
|
93
|
+
|
93
94
|
# Load any config files in the current directory only if
|
94
95
|
# a config hasn't already been found
|
95
96
|
conf = {}
|
@@ -105,6 +106,7 @@ module Gondola
|
|
105
106
|
data = false
|
106
107
|
end
|
107
108
|
end
|
109
|
+
|
108
110
|
# Recurse through the parent directories and merge the
|
109
111
|
# current configuration
|
110
112
|
unless file == File.dirname(file)
|
@@ -116,24 +118,35 @@ module Gondola
|
|
116
118
|
# Function to run and parallelize the given test on the given browsers
|
117
119
|
def run_test(converter, global, browsers)
|
118
120
|
# Spawn n threads
|
119
|
-
Parallel.map(browsers, :in_threads => browsers.size) do |
|
121
|
+
Parallel.map(browsers, :in_threads => browsers.size) do |browser|
|
120
122
|
# Add global information to this request
|
121
|
-
request.merge
|
122
|
-
#
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
123
|
+
request = browser.merge global
|
124
|
+
# Initialize the tester object with a request and a converter
|
125
|
+
tester = Gondola::Tester.new(request, converter)
|
126
|
+
|
127
|
+
# Initialize test
|
128
|
+
tester.setup
|
129
|
+
changed # Notify Observers
|
130
|
+
result = {
|
131
|
+
:id => tester.job_id,
|
132
|
+
:name => global[:job_name],
|
133
|
+
:browser => browser,
|
134
|
+
:status => tester.status
|
135
|
+
}
|
136
|
+
# Send information to any observers
|
137
|
+
notify_observers(result)
|
138
|
+
|
139
|
+
# Run test
|
128
140
|
tester.begin
|
129
|
-
|
130
|
-
result =
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
141
|
+
changed # Notify Observers
|
142
|
+
result[:status] = tester.status
|
143
|
+
# Record the results of the test
|
144
|
+
result[:errors] = tester.errors
|
145
|
+
# Send information to any observers
|
146
|
+
notify_observers(result)
|
147
|
+
|
148
|
+
# Add result to the suiterunner's list
|
149
|
+
@results.push result
|
137
150
|
end
|
138
151
|
end
|
139
152
|
end
|
data/lib/gondola/tester.rb
CHANGED
@@ -8,95 +8,98 @@ module Gondola
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class Tester
|
11
|
-
attr_reader :cmd_num, :errors, :job_id
|
12
|
-
attr_accessor :sel
|
11
|
+
attr_reader :cmd_num, :errors, :job_id, :status
|
13
12
|
|
14
|
-
def initialize(
|
15
|
-
@sel =
|
13
|
+
def initialize(req, converter)
|
14
|
+
@sel = Gondola::Selenium.new req
|
16
15
|
@converter = converter
|
17
16
|
@cmd_num = 0
|
18
17
|
@errors = []
|
19
18
|
end
|
20
19
|
|
21
|
-
|
20
|
+
# Start a new Sauce Labs' job and return the session_id
|
21
|
+
def setup
|
22
22
|
begin
|
23
23
|
@sel.start()
|
24
24
|
@job_id = @sel.session_id
|
25
|
+
@status = :in_progress
|
26
|
+
rescue ::Selenium::Client::CommandError => e
|
27
|
+
add_error e.message
|
28
|
+
finish
|
29
|
+
end
|
30
|
+
@job_id
|
31
|
+
end
|
32
|
+
|
33
|
+
# Issue all the test commands, catching any errors
|
34
|
+
def begin
|
35
|
+
begin
|
25
36
|
eval(@converter.ruby)
|
26
|
-
rescue AssertionError
|
37
|
+
rescue AssertionError
|
27
38
|
rescue ::Selenium::Client::CommandError => e
|
28
|
-
|
29
|
-
:error => e.message })
|
39
|
+
add_error e.message
|
30
40
|
ensure
|
31
|
-
|
32
|
-
if @errors.empty?
|
33
|
-
@sel.passed!
|
34
|
-
else
|
35
|
-
@sel.failed!
|
36
|
-
end
|
37
|
-
@sel.stop()
|
38
|
-
rescue ::Selenium::Client::CommandError => e
|
39
|
-
$stderr.puts e.message + "(Most likely, the test was closed early on Sauce Labs' end)"
|
40
|
-
end
|
41
|
+
finish
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
44
45
|
private
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
# Shutdown the Sauce Labs' job and report the status
|
48
|
+
# of the test
|
49
|
+
def finish
|
50
|
+
begin
|
51
|
+
if @errors.empty?
|
52
|
+
@status = :passed
|
53
|
+
@sel.passed!
|
54
|
+
else
|
55
|
+
@status = :failed
|
56
|
+
@sel.failed!
|
57
|
+
end
|
58
|
+
@sel.stop()
|
59
|
+
rescue ::Selenium::Client::CommandError
|
60
|
+
end
|
52
61
|
end
|
53
62
|
|
54
|
-
def
|
55
|
-
|
63
|
+
def cmd_inc
|
64
|
+
@cmd_num+=1
|
56
65
|
end
|
57
66
|
|
58
|
-
|
59
|
-
|
67
|
+
# Add the current command to the error list
|
68
|
+
# with the given description
|
69
|
+
def add_error(desc)
|
70
|
+
@errors.push({
|
71
|
+
:cmd_num => @cmd_num,
|
72
|
+
:command => @converter.commands[@cmd_num],
|
73
|
+
:error => desc
|
74
|
+
})
|
60
75
|
end
|
61
76
|
|
62
|
-
|
63
|
-
|
77
|
+
# Handle all the assert functions by just making the respective
|
78
|
+
# verify call and throwing an exception to end the flow
|
79
|
+
def method_missing(method, *args)
|
80
|
+
if method.to_s =~ /^assert(.*)/
|
81
|
+
raise AssertionError unless send "verify#{$1}".to_sym, *args
|
82
|
+
end
|
64
83
|
end
|
65
84
|
|
66
85
|
def verify(expr)
|
67
|
-
unless expr
|
68
|
-
|
69
|
-
:error => "returned false, expecting true" })
|
70
|
-
return false
|
71
|
-
end
|
72
|
-
return true
|
86
|
+
add_error "ERROR: Command returned false, expecting true" unless expr
|
87
|
+
return expr
|
73
88
|
end
|
74
89
|
|
75
90
|
def verify_not(expr)
|
76
|
-
if expr
|
77
|
-
|
78
|
-
:error => "returned true, expecting false" })
|
79
|
-
return false
|
80
|
-
end
|
81
|
-
return true
|
91
|
+
add_error "ERROR: Command returned true, expecting false" if expr
|
92
|
+
return !expr
|
82
93
|
end
|
83
94
|
|
84
95
|
def verify_equal(eq, expr)
|
85
|
-
unless eq == expr
|
86
|
-
|
87
|
-
:error => "returned '#{expr}', expecting '#{eq}'" })
|
88
|
-
return false
|
89
|
-
end
|
90
|
-
return true
|
96
|
+
add_error "ERROR: Command returned '#{expr}', expecting '#{eq}'" unless eq == expr
|
97
|
+
return eq == expr
|
91
98
|
end
|
92
99
|
|
93
100
|
def verify_not_equal(eq, expr)
|
94
|
-
|
95
|
-
|
96
|
-
:error => "returned '#{expr}', expecting anything but" })
|
97
|
-
return false
|
98
|
-
end
|
99
|
-
return true
|
101
|
+
add_error "ERROR: Command returned '#{expr}', expecting anything but" unless eq != expr
|
102
|
+
return eq != expr
|
100
103
|
end
|
101
104
|
end
|
102
105
|
end
|
data/lib/gondola/version.rb
CHANGED
data/lib/gondola.rb
CHANGED
data/test/test_converter.rb
CHANGED
@@ -47,6 +47,7 @@ class TestConverter < Test::Unit::TestCase
|
|
47
47
|
cmd_inc
|
48
48
|
}.lines.map { |l| l.strip! }.join("\n")
|
49
49
|
assert_equal expected, @converter.ruby
|
50
|
+
assert_equal 19, @converter.commands.size
|
50
51
|
end
|
51
52
|
|
52
53
|
should "properly extract the name of the test from the given file" do
|
@@ -98,6 +99,7 @@ class TestConverter < Test::Unit::TestCase
|
|
98
99
|
cmd_inc
|
99
100
|
}.lines.map { |l| l.strip! }.join("\n")
|
100
101
|
assert_equal expected, @converter.ruby
|
102
|
+
assert_equal 17, @converter.commands.size
|
101
103
|
end
|
102
104
|
|
103
105
|
should "properly extract the name of the test from the given file" do
|
data/test/test_fail.rb
CHANGED
@@ -9,44 +9,46 @@ end
|
|
9
9
|
class TestFail < Test::Unit::TestCase
|
10
10
|
context "A Ruby Failing Test" do
|
11
11
|
setup do
|
12
|
-
@runner = Gondola::
|
12
|
+
@runner = Gondola::SuiteRunner.new
|
13
13
|
@runner.add_test "test/test_projects/example2/gondola_agora_fail.rb"
|
14
14
|
end
|
15
15
|
|
16
16
|
should "result in a failing test" do
|
17
17
|
VCR.use_cassette('failing_test1', :record => :new_episodes) do
|
18
18
|
@runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
|
19
|
-
expected = [{
|
20
|
-
:command=>{
|
21
|
-
:ruby=>"assert @sel.is_text_present(\"Producer FAIL\")\n"
|
22
|
-
},
|
23
|
-
:error=>"returned false, expecting true"
|
24
|
-
}]
|
25
|
-
assert @runner.results.size == 1
|
26
|
-
assert_equal expected, @runner.results[0][:result]
|
27
19
|
end
|
20
|
+
expected = [{
|
21
|
+
:cmd_num=>12,
|
22
|
+
:command=>{
|
23
|
+
:ruby=>"assert @sel.is_text_present(\"Producer FAIL\")\n"
|
24
|
+
},
|
25
|
+
:error=>"ERROR: Command returned false, expecting true"
|
26
|
+
}]
|
27
|
+
assert @runner.results.size == 1
|
28
|
+
assert_equal expected, @runner.results[0][:errors]
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
31
32
|
context "An HTML Failing Test" do
|
32
33
|
setup do
|
33
|
-
@runner = Gondola::
|
34
|
+
@runner = Gondola::SuiteRunner.new
|
34
35
|
@runner.add_test "test/test_projects/example1/gondola_agora_fail.html"
|
35
36
|
end
|
36
37
|
|
37
38
|
should "result in a failing test" do
|
38
39
|
VCR.use_cassette('failing_test2', :record => :new_episodes) do
|
39
40
|
@runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
|
40
|
-
expected = [{
|
41
|
-
:command=>{
|
42
|
-
:original=>"assertTextPresent(\"Producer FAIL\")",
|
43
|
-
:ruby=>"assert @sel.is_text_present(\"Producer FAIL\")"
|
44
|
-
},
|
45
|
-
:error=>"returned false, expecting true"
|
46
|
-
}]
|
47
|
-
assert @runner.results.size == 1
|
48
|
-
assert_equal expected, @runner.results[0][:result]
|
49
41
|
end
|
42
|
+
expected = [{
|
43
|
+
:cmd_num=>11,
|
44
|
+
:command=>{
|
45
|
+
:selenese=>"assertTextPresent(\"Producer FAIL\")",
|
46
|
+
:ruby=>"assert @sel.is_text_present(\"Producer FAIL\")"
|
47
|
+
},
|
48
|
+
:error=>"ERROR: Command returned false, expecting true"
|
49
|
+
}]
|
50
|
+
assert @runner.results.size == 1
|
51
|
+
assert_equal expected, @runner.results[0][:errors]
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
data/test/test_pass.rb
CHANGED
@@ -7,9 +7,9 @@ VCR.config do |c|
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class TestPass < Test::Unit::TestCase
|
10
|
-
context "A Ruby
|
10
|
+
context "A Ruby Passing Test" do
|
11
11
|
setup do
|
12
|
-
@runner = Gondola::
|
12
|
+
@runner = Gondola::SuiteRunner.new
|
13
13
|
@runner.add_test "test/test_projects/example2/gondola_agora_pass.rb"
|
14
14
|
end
|
15
15
|
|
@@ -17,14 +17,14 @@ class TestPass < Test::Unit::TestCase
|
|
17
17
|
VCR.use_cassette('passing_test1', :record => :new_episodes) do
|
18
18
|
@runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
|
19
19
|
assert @runner.results.size == 1
|
20
|
-
assert_equal
|
20
|
+
assert_equal :passed, @runner.results[0][:status]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
context "An HTML
|
25
|
+
context "An HTML Passing Test" do
|
26
26
|
setup do
|
27
|
-
@runner = Gondola::
|
27
|
+
@runner = Gondola::SuiteRunner.new
|
28
28
|
@runner.add_test "test/test_projects/example1/gondola_agora_pass.html"
|
29
29
|
end
|
30
30
|
|
@@ -32,7 +32,7 @@ class TestPass < Test::Unit::TestCase
|
|
32
32
|
VCR.use_cassette('passing_test2', :record => :new_episodes) do
|
33
33
|
@runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
|
34
34
|
assert @runner.results.size == 1
|
35
|
-
assert_equal
|
35
|
+
assert_equal :passed, @runner.results[0][:status]
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class MockSuiteRunner < Gondola::SuiteRunner
|
4
4
|
attr_accessor :files_ran
|
5
5
|
|
6
6
|
def initialize
|
@@ -14,10 +14,10 @@ class MockTestRunner < Gondola::TestRunner
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
class
|
17
|
+
class SuiteRunner < Test::Unit::TestCase
|
18
18
|
context "Recursive projects" do
|
19
19
|
setup do
|
20
|
-
@runner =
|
20
|
+
@runner = MockSuiteRunner.new
|
21
21
|
@runner.add_test "test/test_projects/"
|
22
22
|
@runner.run :recursive => true
|
23
23
|
end
|
@@ -34,7 +34,7 @@ class TestRunner < Test::Unit::TestCase
|
|
34
34
|
|
35
35
|
context "Configs" do
|
36
36
|
setup do
|
37
|
-
@runner =
|
37
|
+
@runner = MockSuiteRunner.new
|
38
38
|
@runner.add_test "test/test_projects/"
|
39
39
|
end
|
40
40
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gondola
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matthew Perry
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-26 00:00:00 -04:00
|
14
14
|
default_executable: gondola
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
23
|
+
version: 0.19.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
@@ -112,8 +112,8 @@ files:
|
|
112
112
|
- lib/gondola/converter.rb
|
113
113
|
- lib/gondola/html_converter.rb
|
114
114
|
- lib/gondola/selenium.rb
|
115
|
+
- lib/gondola/suiterunner.rb
|
115
116
|
- lib/gondola/tester.rb
|
116
|
-
- lib/gondola/testrunner.rb
|
117
117
|
- lib/gondola/version.rb
|
118
118
|
- test/helper.rb
|
119
119
|
- test/test_converter.rb
|
@@ -126,7 +126,7 @@ files:
|
|
126
126
|
- test/test_projects/example2/config.yml
|
127
127
|
- test/test_projects/example2/gondola_agora_fail.rb
|
128
128
|
- test/test_projects/example2/gondola_agora_pass.rb
|
129
|
-
- test/
|
129
|
+
- test/test_suiterunner.rb
|
130
130
|
has_rdoc: true
|
131
131
|
homepage: http://github.com/perrym5/gondola
|
132
132
|
licenses:
|
@@ -141,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
hash:
|
144
|
+
hash: 145022769040170971
|
145
145
|
segments:
|
146
146
|
- 0
|
147
147
|
version: "0"
|
@@ -165,4 +165,4 @@ test_files:
|
|
165
165
|
- test/test_pass.rb
|
166
166
|
- test/test_projects/example2/gondola_agora_fail.rb
|
167
167
|
- test/test_projects/example2/gondola_agora_pass.rb
|
168
|
-
- test/
|
168
|
+
- test/test_suiterunner.rb
|