Class: Testjour::QueueingExecutor
- Inherits:
-
Cucumber::Tree::TopDownVisitor
- Object
- Cucumber::Tree::TopDownVisitor
- Testjour::QueueingExecutor
show all
- Defined in:
- lib/testjour/cucumber_extensions/queueing_executor.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(queue_server, step_mother) ⇒ QueueingExecutor
Returns a new instance of QueueingExecutor.
14
15
16
17
18
19
20
21
22
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 14
def initialize(queue_server, step_mother)
@queue_server = queue_server
@step_count = 0
@passed = 0
@skipped = 0
@pending = 0
@result_uris = []
@errors = []
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
114
115
116
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 114
def method_missing(*args)
end
|
Class Attribute Details
.queue ⇒ Object
Returns the value of attribute queue.
11
12
13
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 11
def queue
@queue
end
|
Instance Attribute Details
Returns the value of attribute formatter.
8
9
10
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 8
def formatter
@formatter
end
|
#step_count ⇒ Object
Returns the value of attribute step_count.
7
8
9
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 7
def step_count
@step_count
end
|
Instance Method Details
#failed? ⇒ Boolean
47
48
49
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 47
def failed?
@errors.any?
end
|
#log_result(uri, dot, message, backtrace) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 52
def log_result(uri, dot, message, backtrace)
@result_uris << uri
@result_uris.uniq!
case dot
when "."
@passed += 1
when "F"
@errors << [message, backtrace]
when "P"
@pending += 1
when "_"
@skipped += 1
end
end
|
#print_errors ⇒ Object
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 78
def print_errors
@errors.each_with_index do |error, i|
message, backtrace = error
puts
puts Colorer.failed("#{i+1})")
puts Colorer.failed(message)
puts Colorer.failed(backtrace)
end
end
|
#print_summary ⇒ Object
68
69
70
71
72
73
74
75
76
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 68
def print_summary
puts
puts
puts Colorer.passed("#{@passed} steps passed") unless @passed.zero?
puts Colorer.failed("#{@errors.size} steps failed") unless @errors.empty?
puts Colorer.skipped("#{@skipped} steps skipped") unless @skipped.zero?
puts Colorer.pending("#{@pending} steps pending") unless @pending.zero?
puts
end
|
#visit_feature(feature) ⇒ Object
89
90
91
92
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 89
def visit_feature(feature)
super
@queue_server.write_work(feature.file)
end
|
#visit_regular_scenario(scenario) ⇒ Object
98
99
100
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 98
def visit_regular_scenario(scenario)
visit_scenario(scenario)
end
|
#visit_regular_step(step) ⇒ Object
106
107
108
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 106
def visit_regular_step(step)
visit_step(step)
end
|
#visit_row_scenario(scenario) ⇒ Object
94
95
96
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 94
def visit_row_scenario(scenario)
visit_scenario(scenario)
end
|
#visit_row_step(step) ⇒ Object
102
103
104
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 102
def visit_row_step(step)
visit_step(step)
end
|
#visit_step(step) ⇒ Object
110
111
112
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 110
def visit_step(step)
@step_count += 1
end
|
#wait_for_results ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/testjour/cucumber_extensions/queueing_executor.rb', line 24
def wait_for_results
progress_bar = ProgressBar.new("0 slaves", step_count)
step_count.times do
log_result(*@queue_server.take_result)
if failed?
progress_bar.colorer = Testjour::Colorer.method(:failed).to_proc
progress_bar.title = "#{@result_uris.size} slaves, #{@errors.size} failures"
else
progress_bar.colorer = Testjour::Colorer.method(:passed).to_proc
progress_bar.title = "#{@result_uris.size} slaves"
end
progress_bar.inc
end
progress_bar.finish
print_summary
print_errors
end
|